def map_structure(operation, *param_groups):
    """ Expects a pair of list of lists of identical structure representing
    two sets of parameter states. This will apply the desired operation to
    each element in the two groups
    :param param_groups_1: The first parameter group
    :param param_groups_2: The second parameter group
    :return: A list of lists which is the result of the operation applied to
    each pair of elements in the inputs
    """

    param_groups_return = []

    for groups in zip(*param_groups):
        group_grads = []
        for ps in zip(*groups):
            group_grads.append(operation(*ps))
        param_groups_return.append(group_grads)

    return param_groups_return