code: def flatten(l, types=(list, float)):
      
      l = [item if isinstance(item, types) else [item] for item in l]
      return [item for sublist in l for item in sublist]
docs: Flat nested list of lists into a single list.