Вы можете сделать это рекурсивно:
def flatten(l, level=None):
if level == 0:
return l
flattened = []
for item in l:
if isinstance(item, list):
flattened.extend(flatten(item, level-1 if level is not None else None))
else:
flattened.append(item)
return flattened
ls2 = [1,[2,3],[4,[5,6]]]
print(flatten(ls2, level=1))
# [1, 2, 3, 4, [5, 6]]
print(flatten(ls2, level=2))
# [1, 2, 3, 4, 5, 6]
print(flatten(ls2))
# [1, 2, 3, 4, 5, 6]