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