def filter_df(summary_df, country_list, feat_list, year_range):
    """
    Helper func to filter summary_df to countries, columns (feat_list), and list of years.
    Keep "country", "happiness_score", "year" for downstream tasks
    """
    year_list = list(range(min(year_range), max(year_range) + 1))

    if country_list == []:
        country_list = summary_df.country.unique().tolist()

    return summary_df.loc[
        ((summary_df.country.isin(country_list)) & (summary_df.year.isin(year_list))),
        feat_list + ["country", "happiness_score", "year", "country_code"],
    ]