def encode_b64(data):
    '''Wrapper for b64encode, without having to struggle with bytestrings.'''
    byte_string = data.encode('utf-8')
    encoded = base64.b64encode(byte_string)
    return encoded.decode('utf-8')
def encode_b64 ( data ) : byte_string = data . encode ( 'utf-8' ) encoded = base64 . b64encode ( byte_string ) return encoded . decode ( 'utf-8' )
Wrapper for b64encode, without having to struggle with bytestrings.