def decode_bytes ( string ) : if is_string_type ( type ( string ) ) : string = bytes ( string , "utf-8" ) return base64 . decodebytes ( string )
decode base64 text string in python
Decodes a given base64 string into bytes .
def decode_bytes(string):
    """ Decodes a given base64 string into bytes.

    :param str string: The string to decode
    :return: The decoded bytes
    :rtype: bytes
    """

    if is_string_type(type(string)):
        string = bytes(string, "utf-8")
    return base64.decodebytes(string)