from typing import Mapping
from typing import Any
import base64
import json


def decode_token_claims(token: str) -> "Mapping[str, Any]":
    """
    Decode the claims section from a JSON Web Token (JWT).

    Note that the signature is NOT verified; this is the responsibility of the caller!
    """
    components = token.split(".", 3)
    if len(components) != 3:
        raise ValueError("not a JWT")

    pad_bytes = "=" * (-len(components[1]) % 4)
    claim_str = base64.urlsafe_b64decode(components[1] + pad_bytes)
    return json.loads(claim_str)