def METHOD_NAME(
    payload: JSONData,
    key: str,
    *,  # Force passing optional arguments by keyword
    algorithm: str = "HS256",
    headers: JSONData | None = None,
) -> str:
    """Encode a JWT token containing the provided payload/claims.
    :param payload: The JSON payload to create a token for, not yet encoded to JSON.
    :param key: The key as bytes.  The exactly required shape of the bytes depends on the
       algorithm chosen, see :func:decode:.
    :param algorithm: The algorithm used to sign the payload.
    :param headers: Any headers to encode into the token.  Headers are not part of the
       signed payload and can be tampered with.  They can however help identify the key that
       needs to be used to verify the payload, as long as the payload contains enough
       information to also validate the key used was correct.
    """
    # TODO: We do not currently have type-safety for keys suitable for decoding *and*
    # encoding vs those only suitable for decoding.
    if headers is None:
        headers = {}
    # This type is checked in the tests so this is fine.
    return pyjwt.METHOD_NAME(payload, key, algorithm=algorithm, headers=headers)