Determine whether etype is a Union

def is_union(etype) -> bool:
    """ Determine whether etype is a Union """
    return getattr(etype, '__origin__', None) is not None and \
           getattr(etype.__origin__, '_name', None) and\
           etype.__origin__._name == 'Union'