import base64
import StringIO
a = "this is a test"
b = base64.encodestring(a)
print b
print base64.decodestring(b)
c = StringIO.StringIO()
c.write(a)
d = StringIO.StringIO()
e = StringIO.StringIO()
c.seek(0)
base64.encode(c, d)
print d.getvalue()
d.seek(0)
base64.decode(d, e)
print e.getvalue()
a = "this is a +test"
b = base64.urlsafe_b64encode(a)
print b
print base64.urlsafe_b64decode(b)
import StringIO
a = "this is a test"
b = base64.encodestring(a)
print b
print base64.decodestring(b)
c = StringIO.StringIO()
c.write(a)
d = StringIO.StringIO()
e = StringIO.StringIO()
c.seek(0)
base64.encode(c, d)
print d.getvalue()
d.seek(0)
base64.decode(d, e)
print e.getvalue()
a = "this is a +test"
b = base64.urlsafe_b64encode(a)
print b
print base64.urlsafe_b64decode(b)