<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply_new_scoped_variable_name(self, path, new_name):
 """Applies the new name of the scoped variable defined by path :param str path: The path identifying the edited variable :param str new_name: New name """

        data_port_id = self.list_store[path][self.ID_STORAGE_ID]
        try:
            if self.model.state.scoped_variables[data_port_id].name != new_name:
                self.model.state.scoped_variables[data_port_id].name = new_name
        except TypeError as e:
            logger.error("Error while changing port name: {0}".format(e))