How to branch recursion into returning only a list of lists (Python) : I'm having a problem where I what I need returning should be a list of lists, with each nested list being a list of 2 strings. I can't find a way to flatten this list effectively, or to return just the list of lists, as the number of nested lists is undeterminable. This is happening in my recursive function, where I branch into 3 different paths of recursion for each recursive loop.
What I have so far is:
```
def f(used, sequences):
    if sequences[0] == '' or sequences[1] == '':
        if sequences[0] == '' and sequences[1] == '':
            return [used[0], used[1]]
        elif sequences[0] != '':
            return [used[0] + sequences[0], used[1] + '-' * len(sequences[0])]
        elif sequences[1] != '':
            return [used[0] + '-' * len(sequences[1]), used[1] + sequences[1]]
    else:
        return [f([sequences[0][-1] + used[0], sequences[1][-1] + used[1]], [sequences[0][:-1], sequences[1][:-1]]),
        f([sequences[0][-1] + used[0], '-' + used[1]], [sequences[0][:-1], sequences[1]]),
        f(['-' + used[0], sequences[1][-1] + used[1]], [sequences[0], sequences[1][:-1]])]
```
which will generate something like `[[[['str', 'str'], ['str', 'str'], ['str', 'str']], [['str, 'str']... ` when I want it to come out as `[['str', 'str'], ['str', 'str'], ['str', 'str']...`
Is there a way to fix my recursion so that this is the case, or a function I can write to flatten it the way I want?