code: def to_unicode_optional_iterator(x):
      
      if isinstance(x, STRING_TYPES):
          return to_unicode(x)
  
      try:
          l = list(x)
      except TypeError as e:
          assert 'is not iterable' in str(e)
          return x
      else:
          return [ to_unicode(e) for e in l ]
docs: Raise TypeError if x is a str containing non-utf8 bytes or if x is
      an iterable which contains such a str.