def interpolate_group(group, classes, params, group_names):
    """
    In the dict returned by get_nm_group, replace class
    and parameter IDs, and other group IDs, with their
    appropriate string or dict representations.

    :param group: the Group dict returned by get_nm_group()
    :type group: dict
    :param classes: the dict of classes returned by get_nm_group_classes()
    :type classes: dict
    :param params: the dict of parameters returned by get_nm_group_params()
    :type params: dict
    :param group_names: the dict of group IDs to names returned by get_group_names()
    :type group_names: dict
    :returns: group dict, with classes and params interpolated
    :rtype: dict
    """
    g_params = group.get('parameters', {})
    params_text = {}
    for p in g_params:
        foo = params[p]
        params_text[foo['paramkey']] = foo['paramvalue']
    group['parameters'] = params_text

    g_classes = group.get('classes', {})
    classes_text = {}
    for c in g_classes:
        foo = classes[c]
        classes_text[foo['classname']] = foo['classparams']
    group['classes'] = classes_text

    g_parents = group.get('parents', {})
    parents_text = []
    for p in g_parents:
        parents_text.append(group_names[p])
    group['parents'] = parents_text

    g_groups = group.get('groups', {})
    groups_text = []
    for g in g_groups:
        groups_text.append(group_names[g])
    group['groups'] = groups_text

    return group