import base64


def base64_encode(string):
    """
    base64's `urlsafe_b64encode` uses '=' as padding.
    These are not URL safe when used in URL parameters.

    Removes any `=` used as padding from the encoded string.
    """
    encoded = base64.urlsafe_b64encode(string)
    return encoded.rstrip(b"=")