def change_subparameter_indices(
        self,
        param_name,
        changes,
    ):
        """Change the name of subparameters listed.

        Parameters
        ==========

        param_name (string)
            name of the parameters whose subparameters
            will have their names changes
        changes (list of 2-tuples)
            contains pairs of indices where the first
            index represents the current index of the
            subparameter and the second one the new
            index to be assumed by it. It is ok if it
            is empty, in which case no changes take
            place.
        """
        ### reference list of subparam indices for this
        ### parameter
        subparam_indices = self.data["subparam_map"][param_name]

        ### reference list of subparams for unpacking for
        ### the parameter
        subparams_for_unpacking = self.data["subparam_unpacking_map"][param_name]

        ### reference map containing subparam unpacking
        ### icon flmap for the parameter
        unpacking_icon_flmap_for_param = self.subparam_unpacking_icon_flmap[param_name]

        ### list all maps that need to be fixed in case any
        ### subparameter needs to have its name fixed

        maps_to_fix = (
            self.data["subparam_widget_map"][param_name],
            self.input_socket_live_flmap[param_name],
            self.subparam_up_button_flmap[param_name],
            self.subparam_down_button_flmap[param_name],
            self.widget_live_flmap[param_name],
            self.widget_remove_button_flmap[param_name],
            self.subparam_rectsman_map[param_name],
        )

        ### iterate over needed changes, performing them
        ### one by one;
        ###
        ### it is important that they are iterated in the same order
        ### in which they are in the 'changes' sequence, to avoid
        ### shadowing during the fixes;

        for current_index, right_index in changes:

            ## fix subparam index

            i = subparam_indices.index(current_index)
            subparam_indices[i] = right_index

            ## fix maps

            for a_map in maps_to_fix:

                # if the current index exists in the
                # map, pop its value and assign it
                # to the right name

                try:
                    value = a_map.pop(current_index)
                except KeyError:
                    pass
                else:
                    a_map[right_index] = value

                # XXX this call to update() below should
                # perhaps be nested within the else-block
                # above, but don't move it before being
                # sure of it

                # using 'update' without arguments
                # has no effect in built-in dict
                # instances, but has a special
                # effect on a special dict subclass
                # we use, which needs this operation
                # whenever it is changed
                a_map.update()

            ## if the subparameter is marked for
            ## unpacking, fix the index in related
            ## maps

            if current_index in subparams_for_unpacking:

                unpacking_icon_flmap_for_param[right_index] = (
                    unpacking_icon_flmap_for_param.pop(current_index)
                )

                ## since the flat values list didn't
                ## actually change, the call which is
                ## commented out below isn't actually
                ## needed, but we keep it just to
                ## serve as an example where changing
                ## flat list dict instances doesn't
                ## require it to be updated
                ## self.subparam_unpacking_icon_flmap.update()

                ###

                subparams_for_unpacking.remove(current_index)

                subparams_for_unpacking.append(right_index)

                subparams_for_unpacking.sort()

            ## else if the parameter is of keyword variable
            ## kind, fix the index in the related maps

            elif self.var_kind_map[param_name] == "var_key":

                self.subparam_keyword_entry_live_map[right_index] = (
                    self.subparam_keyword_entry_live_map.pop(current_index)
                )

                self.data["subparam_keyword_map"][right_index] = (
                    self.data["subparam_keyword_map"].pop(current_index)
                )

            ## retrieve a reference to the input socket
            input_socket = self.input_socket_live_flmap[param_name][right_index]

            ## store its current custom id and update its
            ## subparameter index with the right name

            old_id = input_socket.get_id()
            input_socket.subparameter_index = right_index

            ## if the input socket has a parent, fix the
            ## socket tree data to take the change in the
            ## subparameter index into account

            try:
                input_socket.parent

            except AttributeError:
                pass

            else:
                APP_REFS.gm.fix_input_socket_id(
                    input_socket,
                    old_id,
                )
Change the name of subparameters listed.

        Parameters
        ==========

        param_name (string)
            name of the parameters whose subparameters
            will have their names changes
        changes (list of 2-tuples)
            contains pairs of indices where the first
            index represents the current index of the
            subparameter and the second one the new
            index to be assumed by it. It is ok if it
            is empty, in which case no changes take
            place.
        
nodezator/graphman/callablenode/subparam/main.py