def flatten_list(l):
if (l == []) or (l is None):<EOL><INDENT>return l<EOL><DEDENT>if isinstance(l[<NUM_LIT:0>], list):<EOL><INDENT>return flatten_list(l[<NUM_LIT:0>]) + flatten_list(l[<NUM_LIT:1>:])<EOL><DEDENT>return l[:<NUM_LIT:1>] + flatten_list(l[<NUM_LIT:1>:])<EOL>
Unpacks lists in a list:

    [1, 2, [3, 4], [5, [6, 7]]]

becomes

    [1, 2, 3, 4, 5, 6, 7]

http://stackoverflow.com/a/12472564/3381305