def flat_list ( input_list ) : x = input_list if isinstance ( x , list ) : return [ a for i in x for a in flat_list ( i ) ] else : return [ x ]
can lists can be nested arbitrarily deep in python
r Given a list of nested lists of arbitrary depth returns a single level or flat list .
def flat_list(input_list):
    r"""
    Given a list of nested lists of arbitrary depth, returns a single level or
    'flat' list.

    """
    x = input_list
    if isinstance(x, list):
        return [a for i in x for a in flat_list(i)]
    else:
        return [x]