code: def is_redundant_union_item(first, other):
      # type: (AbstractType, AbstractType) -> bool
      
      if isinstance(first, ClassType) and isinstance(other, ClassType):
          if first.name == 'str' and other.name == 'Text':
              return True
          elif first.name == 'bool' and other.name == 'int':
              return True
          elif first.name == 'int' and other.name == 'float':
              return True
          elif (first.name in ('List', 'Dict', 'Set') and
                    other.name == first.name):
              if not first.args and other.args:
                  return True
              elif len(first.args) == len(other.args) and first.args:
                  result = all(first_arg == other_arg or other_arg == AnyType()
                               for first_arg, other_arg
                               in zip(first.args, other.args))
                  return result
  
      return False
docs: If union has both items, is the first one redundant?
  
      For example, if first is 'str' and the other is 'Text', return True.
  
      If items are equal, return False.