import base64 encoded = base64.b64encode('base64 encoded string') print encoded