def uniontypes(type_: Type[Any]) -> Set[Type[Any]]:
    '''
    Returns the types of a Union.

    Raises ValueError if the argument is not a Union
    and AttributeError when running on an unsupported
    Python version.
    '''
    if not is_union(type_):
        raise ValueError('Not a Union: ' + str(type_))

    if hasattr(type_, '__args__'):
        return set(type_.__args__)
    elif hasattr(type_, '__union_params__'):
        return set(type_.__union_params__)
    raise AttributeError('The typing API for this Python version is unknown')
Returns the types of a Union.

    Raises ValueError if the argument is not a Union
    and AttributeError when running on an unsupported
    Python version.