code: def flatten(sequence):
      
      for item in sequence:
          if hasattr(item, "__iter__") and not isinstance(item, str) and not isinstance(item, bytes):
              for i in item:
                  yield i
          else:
              yield item
docs: A simple generator which flattens a sequence.
  
      Only one level is flattened.
  
      .. code-block:: python
  
          (1, (2, 3), 4) -> (1, 2, 3, 4)