code: def flatten_iterable(iterable):
      
      for item in iterable:
          if isinstance(item, Iterable) and not isinstance(item, string_types):
              for sub in flatten_iterable(item):
                  yield sub
          else:
              yield item
docs: Flattens a nested iterable into a single layer. Generator.
  
      If you only want to flatten a single level, use more_itertools.flatten.
  
      Example::
  
          >>> nested_iterable = (('t1', 't2'), ['l1', 'l2', ('l1', 'l2')])
          >>> list(flatten_iterable(nested_iterable))
          ['t1', 't2', 'l1', 'l2', 'l1', 'l2']
          >>> set(flatten_iterable(nested_iterable)) == {'t1', 't2', 'l1', 'l2'}
          True