from typing import Final
from typing import get_origin


def is_final_type(tp: type) -> bool:
    """
    Test if the given type is a final type.
    """
    return tp is Final or get_origin(tp) is Final