def get_alternate_types_resolving_forwardref_union_and_typevar(typ, _memo: List[Any] = None)-> Tuple[Any, ...]:
<EOL>_memo = _memo or []<EOL>if typ in _memo:<EOL><INDENT>return tuple()<EOL><DEDENT>_memo.append(typ)<EOL>if is_typevar(typ):<EOL><INDENT>if hasattr(typ, '<STR_LIT>') and typ.__bound__ is not None:<EOL><INDENT>if hasattr(typ, '<STR_LIT>') and typ.__contravariant__:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>return get_alternate_types_resolving_forwardref_union_and_typevar(typ.__bound__, _memo=_memo)<EOL><DEDENT><DEDENT>elif hasattr(typ, '<STR_LIT>') and typ.__constraints__ is not None:<EOL><INDENT>if hasattr(typ, '<STR_LIT>') and typ.__contravariant__:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>return tuple(typpp for c in typ.__constraints__<EOL>for typpp in get_alternate_types_resolving_forwardref_union_and_typevar(c, _memo=_memo))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return object,<EOL><DEDENT><DEDENT>elif is_union_type(typ):<EOL><INDENT>return tuple(t for typpp in get_args(typ, evaluate=True)<EOL>for t in get_alternate_types_resolving_forwardref_union_and_typevar(typpp, _memo=_memo))<EOL><DEDENT>elif is_forward_ref(typ):<EOL><INDENT>return get_alternate_types_resolving_forwardref_union_and_typevar(resolve_forward_ref(typ), _memo=_memo)<EOL><DEDENT>else:<EOL><INDENT>return typ,<EOL><DEDENT>
Returns a tuple of all alternate types allowed by the `typ` type annotation.

If typ is a TypeVar,
 * if the typevar is bound, return get_alternate_types_resolving_forwardref_union_and_typevar(bound)
 * if the typevar has constraints, return a tuple containing all the types listed in the constraints (with
 appropriate recursive call to get_alternate_types_resolving_forwardref_union_and_typevar for each of them)
 * otherwise return (object, )

If typ is a Union, return a tuple containing all the types listed in the union (with
 appropriate recursive call to get_alternate_types_resolving_forwardref_union_and_typevar for each of them)

If typ is a forward reference, it is evaluated and this method is applied to the results.

Otherwise (typ, ) is returned

Note that this function automatically prevent infinite recursion through forward references such as in
`A = Union[str, 'A']`, by keeping a _memo of already met symbols.

:param typ: 
:return: