code: def flatten(iterable):
      
      container = iterable.__class__
  
      placeholder = []
      for item in iterable:
          try:
              placeholder.extend(flatten(item))
          except TypeError:
              placeholder.append(item)
  
      return container(placeholder)
docs: Fully flattens an iterable:
      In: flatten([1,2,3,4,[5,6,[7,8]]])
      Out: [1,2,3,4,5,6,7,8]