def expand_list(array):
    """ Recursively flatten a nested list

    Any lists found are flattened and added to output,
    any other values are just appended to output.

    Parameters
    ----------
    array : list
        The (nested) input list

    Returns
    -------
    list
        A flat list of values
    """

    new_array = []
    for item in array:
        if isinstance(item, list):
            new_array += expand_list(item)
        else:
            new_array.append(item)

    return new_array