Let me show you the basic usages of decode() and encode().
Str = "Hello World!";
Str = Str.encode('base64','strict');
print "Encoded String: " + Str
print "Decoded String: " + Str.decode('base64','strict')
I wrote a program that encodes our program and decodes it later on. And my program is producing the output:
Encoded String: SGVsbG8gV29ybGQh
Decoded String: Hello World!
For more information, please check this documentation