code: def flatten(lst):
      
      for elm in lst:
          if isinstance(elm, collections.Iterable) and not isinstance(
                  elm, string_types):
              for sub in flatten(elm):
                  yield sub
          else:
              yield elm
docs: Flatten list.
      Args:
          lst (list): List to flatten
      Returns:
          generator