def _create_signed_value_urlsafe(handler, name, value):
    """Like tornado's create_signed_value (used in set_secure_cookie), but returns urlsafe bytes"""

    signed_value = handler.create_signed_value(name, value)
    return base64.urlsafe_b64encode(signed_value).rstrip(b"=")
Like tornado's create_signed_value (used in set_secure_cookie), but returns urlsafe bytes
jupyterhub/_xsrf_utils.py