def is_pep484_nonable(typ):
    """
    Checks if a given type is nonable, meaning that it explicitly or implicitly declares a Union with NoneType.
    Nested TypeVars and Unions are supported.

    :param typ:
    :return:
    """
    # TODO rely on typing_inspect if there is an answer to https://github.com/ilevkivskyi/typing_inspect/issues/14
    if typ is type(None):
        return True
    elif is_typevar(typ) or is_union_type(typ):
        return any(is_pep484_nonable(tt) for tt in get_alternate_types_resolving_forwardref_union_and_typevar(typ))
    else:
        return False
def is_pep484_nonable ( typ ) : if typ is type ( None ) : return True elif is_typevar ( typ ) or is_union_type ( typ ) : return any ( is_pep484_nonable ( tt ) for tt in get_alternate_types_resolving_forwardref_union_and_typevar ( typ ) ) else : return False
Checks if a given type is nonable, meaning that it explicitly or implicitly declares a Union with NoneType.
    Nested TypeVars and Unions are supported.

    :param typ:
    :return: