def decode_unicode_string ( string ) : if string . startswith ( '[BASE64-DATA]' ) and string . endswith ( '[/BASE64-DATA]' ) : return base64 . b64decode ( string [ len ( '[BASE64-DATA]' ) : - len ( '[/BASE64-DATA]' ) ] ) return string
check base64 encoding in python
Decode string encoded by unicode_string
def decode_unicode_string(string):
    """
    Decode string encoded by `unicode_string`
    """
    if string.startswith('[BASE64-DATA]') and string.endswith('[/BASE64-DATA]'):
        return base64.b64decode(string[len('[BASE64-DATA]'):-len('[/BASE64-DATA]')])
    return string