Returns True if the provided type is a valid PEP484 type hint, False otherwise.

    Note: string type hints (forward references) are not supported by default, since callers of this function in
    parsyfiles lib actually require them to be resolved already.

    :param typ_hint:
    :param allow_forward_refs:
    :return:

def is_valid_pep484_type_hint(typ_hint, allow_forward_refs: bool = False):
    """
    Returns True if the provided type is a valid PEP484 type hint, False otherwise.

    Note: string type hints (forward references) are not supported by default, since callers of this function in
    parsyfiles lib actually require them to be resolved already.

    :param typ_hint:
    :param allow_forward_refs:
    :return:
    """
    # most common case first, to be faster
    try:
        if isinstance(typ_hint, type):
            return True
    except:
        pass

    # optionally, check forward reference
    try:
        if allow_forward_refs and is_forward_ref(typ_hint):
            return True
    except:
        pass

    # finally check unions and typevars
    try:
        return is_union_type(typ_hint) or is_typevar(typ_hint)
    except:
        return False