code: def flatten(list_to_flatten):
      
  
      def genflatten(lst):
          for elem in lst:
              if isinstance(elem, (list, tuple)):
                  for x in flatten(elem):
                      yield x
              else:
                  yield elem
  
      return list(genflatten(list_to_flatten))
docs: Flatten out a list.