import base64
my_string = "This is my text document.."
encoded_str = base64.b64encode(my_string.encode('ascii'))
print(f"Encoded string: { encoded_str }")
mystr_decoded = base64.b64decode(encoded_str.decode('ascii'))
print(f"Decoded string: { mystr_decoded }")
Output: