def _flatten(list_of_lists):
    """
    Turns a nested list of lists ([a,[b,c]]) into a flat list ([a,b,c]).
    """
    out = []
    if type(list_of_lists) is int:
        return [list_of_lists]
    for item in list_of_lists:
        if type(item) is int:
            out.append(item)
        elif type(item) is list:
            out += _flatten(item)
    return out