def b64encode(source):
    """
    Base64 encoding for python 2 and 3
    
    :rtype: base64 content
    """
    if compat.PY3:
        source = source.encode('utf-8')
    return base64.b64encode(source).decode('utf-8')
Base64 encoding for python 2 and 3
    
    :rtype: base64 content