import base64


def _base64_url_encode(s: bytes) -> str:
    """Base64 encode.

    Example:
        >>> from stkclient import _base64_url_encode
        >>> _base64_url_encode(b'foo')
        'Zm9v'
    """
    return base64.b64encode(s, b"-_").rstrip(b"=").decode("utf8")