code: def flatten(items,enter=lambda x:isinstance(x, list)):
      # http://stackoverflow.com/a/40857703
      # https://github.com/ctmakro/canton/blob/master/canton/misc.py
      
      for x in items:
          if enter(x):
              yield from flatten(x)
          else:
              yield x
docs: Yield items from any nested iterable; see REF.