How Base64 encoding and decoding works, and how it can be used. Then use Python to Base64 encode and decode both text and binary data.