def filter_none(data, split_by_client=False):
    """This function filters out ``None`` values from the given list (or list of lists, when ``split_by_client`` is enabled)."""

    if split_by_client:
        # filter out missing files and empty clients
        existing_data = [
            [d for d in client_data if d is not None] for client_data in data
        ]
        existing_data = [client_data for client_data in existing_data if client_data]
    else:
        # filter out missing files
        existing_data = [d for d in data if d is not None]
    return existing_data