def merge(df, merge_cfg, index_level='parent'):
    """
    Change certain names in an index_level and merge

    Parameters
    ----------
    df : DataFrame-like
        Dataframe input to change some index levels

    merge_cfg : dict
        Dictionary of new labels with values corresponding to a list of
        index values to change into the new label

    index_level : str (default, parent)
        Index to change
    """
    index_names = df.index.names
    tdf = df.reset_index()
    for label, match_labels in merge_cfg.items():
        tdf.loc[tdf[index_level].isin(match_labels), index_level] = label
    return tdf.groupby(index_names).sum()
