<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def on_remove(self, widget, data=None):
 """Removes respective selected core elements and select the next one"""


        path_list = None
        if self.view is not None:
            model, path_list = self.tree_view.get_selection().get_selected_rows()
        old_path = self.get_path()
        models = [self.list_store[path][self.MODEL_STORAGE_ID] for path in path_list] if path_list else []
        if models:
            try:
                self.remove_core_elements(models)
            except AttributeError as e:
                self._logger.warning("The respective core element of {1}.list_store couldn't be removed. -> {0}"
                                  "".format(e, self.__class__.__name__))
            if len(self.list_store) > 0:
                self.tree_view.set_cursor(min(old_path[0], len(self.list_store) - 1))
            return True
        else:
            self._logger.warning("Please select an element to be removed.")