code: def is_union(type_: Type[Any]) -> bool:
      '''
      Union[A, B]
      Union
      Optional[A]
      '''
      if HAS_UNIONSUBCLASS:
          # Old python
          return _issubclass(type_, Union)
      else:
          return getattr(type_, '__origin__', None) == Uniof is_union(type_: Type[Any]) -> bool:
      '''
      Union[A, B]
      Union
      Optional[A]
      '''
      if HAS_UNIONSUBCLASS:
          # Old python
          return _issubclass(type_, Union)
      else:
          return getattr(type_, '__origin__', None) == Union
docs: Union[A, B]
      Union
      Optional[A]