def filter_countries(cdict, meta_df, select):
    """Select countries to display.

    - cdict: dict, key=region, value=dataframe.
    - meta_df: dataframe with metadata (columns ccode, is_recent, etc.).
    - select: selection preset str or comma-separated str.

        - all: everything (a lot)
        - all_recent: almost everything
        - picked: hand-picked selection.
        - countries: full countries; UK counts as one.
        - countries_uk: full countries and parts of UK
        - uk_parts: UK countries
        - eng_parts: England parts.
        - None: equivalent to 'picked'.
        - NL_DK_SEE_20210119: data from NL, DK, SEE available on 19 Jan
        - DK_SEE_20210101: data from DK, SEE available on 1 Jan

    Return:

    - cdict: selected cdict
    - meta_df: subset of original meta_df dataframe
    """
    df = meta_df

    # build a couple of selections (list of keys)
    countries = []
    countries = list(df.index[~df['ccode'].isna() & df['is_recent']])
    uk_national = list(df.index[(df['ccode']=='UK')])
    uk_parts = list(df.index[~df['uk_part'].isna()])
    ch_parts = list(df.index[~df['ch_part'].isna() | (df['ccode'] == 'CH')])
    eng_parts = list(df.index[~df['en_part'].isna() & df['is_recent']])
    all_recent = list(df.index[df['is_recent']])

    keys = []
    if select is None:
        select = 'picked'
    for sel in 'picked' if select is None else select.split(','):
        if sel == 'countries':
            keys += countries
        elif sel == 'countries_uk':
            keys += (countries + uk_parts)
        elif sel == 'uk':
            keys += uk_national + uk_parts + eng_parts
        elif sel == 'ch':
            keys += ch_parts
        elif sel == 'uk_parts':
            keys += uk_parts
        elif sel == 'eng_parts':
            keys += eng_parts
        elif sel == 'NL_DK_SEE_20210119':
            keys += ['DK (seq; 2021-01-01)', 'NL (seq; 2021-01-19; OMT)',
                     'South East England (seq, 2020-12-21)', 'South East England (seq, 2020-12-31)',
                     ]
        elif sel == 'DK_SEE_20210101':
            keys += ['DK (seq; 2021-01-01)',
                     'South East England (seq, 2020-12-21)', 'South East England (seq, 2020-12-31)',
                     ]
        elif sel == 'all':
            keys = list(df.index)
        elif sel == 'all_recent':
            keys += all_recent
        elif sel == 'picked':
            keys += countries + uk_parts + [
                'England (SGTF; multiple regions; 2021-01-15)', 'South East England (seq, 2020-12-31)'
                ]
        else:
            raise KeyError(f'selection {sel!r}')

    keys = df.loc[keys].index.unique()
    new_cdict = {k:cdict[k] for k in keys}
    new_mdf = df.loc[keys]

    return new_cdict, new_mdf