Index: pyyaml/trunk/lib3/yaml/representer.py
===================================================================
--- pyyaml/trunk/lib3/yaml/representer.py	(revision 328)
+++ pyyaml/trunk/lib3/yaml/representer.py	(revision 361)
@@ -145,5 +145,8 @@
 
     def represent_binary(self, data):
-        data = base64.encodestring(data).decode('ascii')
+        if hasattr(base64, 'encodebytes'):
+            data = base64.encodebytes(data).decode('ascii')
+        else:
+            data = base64.encodestring(data).decode('ascii')
         return self.represent_scalar('tag:yaml.org,2002:binary', data, style='|')
 
