if ev_args == t.__args__:
            return t
        if isinstance(t, GenericAlias):
            return GenericAlias(t.__origin__, ev_args)
        if isinstance(t, types.UnionType):
            return functools.reduce(operator.or_, ev_args)
        else:
            return t.copy_with(ev_args)
    return t
class _Final:
    """Mixin to prohibit subclassing."""
    __slots__ = ('__weakref__',)
    def __init_subclass__(cls, /, *args, **kwds):
        if '_root' not in kwds:
            raise TypeError("Cannot subclass special typing classes")
class _Immutable:
    """Mixin to indicate that object should not be copied."""
    __slots__ = ()
    def __copy__(self):
        return self
    def __deepcopy__(self, memo):
        return self
class _NotIterable:
    """Mixin to prevent iteration, without being compatible with Iterable.
    That is, we could do::
        def __iter__(self): raise TypeError()
    But this would make users of this mixin duck type-compatible with
    collections.abc.Iterable - isinstance(foo, Iterable) would be True.
    Luckily, we can instead prevent iteration by setting __iter__ to None, which
    is treated specially.
    """
    __slots__ = ()
    __iter__ = None
# Internal indicator of special typing constructs.
# See __doc__ instance attribute for specific docs.
class _SpecialForm(_Final, _NotIterable, _root=True):
    __slots__ = ('_name', '__doc__', '_getitem')
    def __init__(self, getitem):
        self._getitem = getitem
        self._name = getitem.__name__
        self.__doc__ = getitem.__doc__