<|file_name|>bitten.py<|end_file_name|><｜fim▁begin｜>import codecs

unicode_string = "Hello Python 3 String"

bytes_object = b"Hello Python 3 Bytes"

print(unicode_string, type(unicode_string))

print(bytes_object, type(bytes_object))



#decode to unicode_string

ux = str(object=bytes_object, encoding="utf-8", errors="strict")

print(ux, type(ux))

ux = bytes_object.decode(encoding="utf-8", errors="strict")

print(ux, type(ux))


hex_bytes = codecs.encode(b"Binary Object", "hex_codec")


def string_to_bytes( text ):
    return bin(int.from_bytes(text.encode(), 'big'))

def bytes_to_string( btext ):
    #btext = int('0b110100001100101011011000110110001101111', 2)
    return btext.to_bytes((btext.bit_length() + 7) // 8, 'big').decode()

def char_to_bytes(char):
    return bin(ord(char))

def <|fim_middle|>(text):

    bext = text.encode(encoding="utf-8")
    enc_bext = codecs.encode(bext, "hex_codec")

    return enc_bext.decode("utf-8")

def decodes():
    pass


if __name__ == "__main__":

    print( encodes("walla") )


<｜fim▁end｜>
encodes