| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | fromiteration_utilities importdeepflatten
  
 # if you only have one depth nested_list, use this
 defflatten(l):
   return[item forsublist inl foritem insublist]
  
 l =[[1,2,3],[3]]
 print(flatten(l))
 # [1, 2, 3, 3]
  
 # if you don't know how deep the list is nested
 l =[[1,2,3],[4,[5],[6,7]],[8,[9,[10]]]]
  
 print(list(deepflatten(l, depth=3)))
 # [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
 |