<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_selection_sm_prior_condition(self, state_row_iter, selected_model_list, sm_selected_model_list):
 """State machine prior update of tree selection for one tree model row"""

        selected_path = self.tree_store.get_path(state_row_iter)
        tree_model_row = self.tree_store[selected_path]
        model = tree_model_row[self.MODEL_STORAGE_ID]

        if model not in sm_selected_model_list and model in selected_model_list:
            self._tree_selection.unselect_iter(state_row_iter)
        elif model in sm_selected_model_list and model not in selected_model_list:
            self.tree_view.expand_to_path(selected_path)
            self._tree_selection.select_iter(state_row_iter)