def reorder(lst):
    for i, (cur, nxt) in enumerate(zip(lst, lst[1:])):
        if isinstance(cur, str) and isinstance(nxt, list):
            reorder(nxt)
lst[i:i + 2] = [nxt, cur]
How do I get such a nested lists?