code: def _flatten(n):
      
      if isinstance(n, collections.Sequence):
          for x in n:
              for y in _flatten(x):
                  yield y
      else:
          yield n
docs: Recursively flatten a mixed sequence of sub-sequences and items