from base64 import b64encode, b64decode
raw = '\x00\x01'
enc = b64encode(raw).rstrip('=')

def repad(data):
    return data + '=' * (-len(data) % 4)
Is it ok to remove the equal signs from a base64 string?