def groups(collection, grouped_mci=True):
    """Create a dataframe for each group and save it to a csv file.

    Parameters
    ----------
    collection : pd.DataFrame
        DataFrame has to have a Group column.
    grouped_mci : bool, default True
        If true, 'LMCI' and 'EMCI' are treated like 'MCI'.
        However, the original values will stills be in the output.

    Returns
    -------
    dict
        Dictionnairy with a dataframe for each group.

    """
    collection = collection.copy()
    group_names = collection['Group'].unique()
    groups = {}
    for group in group_names:
        group_df = collection[collection['Group'] == group]
        groups[group] = group_df
    if grouped_mci is True:
        mci = collection[collection['Group'].isin(['MCI', 'LMCI', 'EMCI'])]
        if not mci.empty:
            groups['MCI'] = mci
        if 'LMCI' in group_names:
            del groups['LMCI']
        if 'EMCI' in group_names:
            del groups['EMCI']
    return groups
