def filter_data(dataset, remove_no_school, remove_outliers, begin_date):
    """
    filter lines out of dataset:
    - remove_no_school: bool, if True day considered as non working are removed
    - remove_outliers: bool, if True day considered as outliers are removed from the training set only
    Note that outliers are here:
    - statistical outliers
    - strikes
    - days with no expected guests
    - days with no effective guests
    """
    # remove weekends and holidays
    if remove_no_school:
        mask = (dataset['working'] != 0)
        dataset = dataset.loc[mask]

    # remove outliers
    if remove_outliers:
        mask =\
            (dataset['prevision'] != 0) &\
            (dataset['reel'] != 0) &\
            (dataset['date_str'] <= begin_date) &\
            (dataset['greve'] != 1) &\
            (dataset['upper_outlier'] != 1) &\
            (dataset['lower_outlier'] != 1)  # | (dataset['date_str'] >= begin_date)
        dataset = dataset.loc[mask]

    return dataset