def METHOD_NAME(obj: Any) -> str:
    """Pretty representation of a type, should be as close as possible to the original type definition string.
    Takes some logic from `typing._type_repr`.
    """
    if isinstance(obj, types.FunctionType):
        return obj.__name__
    elif obj is ...:
        return '...'
    elif isinstance(obj, Representation):
        return repr(obj)
    if not isinstance(obj, (_typing_extra.typing_base, _typing_extra.WithArgsTypes, type)):
        obj = obj.__class__
    if _typing_extra.origin_is_union(typing_extensions.get_origin(obj)):
        args = ', '.join(map(METHOD_NAME, typing_extensions.get_args(obj)))
        return f'Union[{args}]'
    elif isinstance(obj, _typing_extra.WithArgsTypes):
        args = ', '.join(map(METHOD_NAME, typing_extensions.get_args(obj)))
        return f'{obj.__qualname__}[{args}]'
    elif isinstance(obj, type):
        return obj.__qualname__
    else:
        return repr(obj).replace('typing.', '').replace('typing_extensions.', '')