def flatten(a):
    """
    Flattens list of lists with arbitrary depth into a 1-D list.

    Parameters
    ----------
    l : list
        list to be flattened
    
    Returns
    -------
    flat_l : list
        flattened list
    """
    flat_l = []
    for el in a:
        if isinstance(el, list):
            flat_l.extend(flatten(el))
        else:
            flat_l.append(el)
    return flat_l