Use pybase64 with the standard base64 API
masterThe pybase64 library uses the same API as Python's standard base64 module (the modern interface introduced in Python 2.4), making it a drop-in replacement for easy integration.
For maximum performance during decoding, it is recommended to use pybase64.b64decode with validate=True whenever possible.
import pybase64
# Standard encoding/decoding with altchars
print(pybase64.b64encode(b'>>>foo???', altchars='_:'))
# b'Pj4_Zm9vPz8:'
print(pybase64.b64decode(b'Pj4_Zm9vPz8:', altchars='_:', validate=True))
# b'>>>foo???'