from typing import Any


def decode_answer(response_data: dict) -> Any:
    """
    Decode the answer described by *response_data*, a substructure of an
    enrollment document.

    Returns a string, number, tuple of strings, or None.
    """
    answer = response_data["answer"]

    if answer["type"] in ["String", "Number"]:
        return answer["value"]

    elif answer["type"] == "Option":
        chosen_options = map(int, answer["chosenOptions"])
        option_tokens = [
            option["token"]
                for option in response_data["options"] ]

        return tuple(
            option_tokens[chosen]
                for chosen in chosen_options)

    elif answer["type"] == "Declined":
        return None

    else:
        raise ValueError(f"Unknown response answer type {answer['type']}")