def METHOD_NAME(self, view, index, value):
    delegate = view.itemDelegateForIndex(index)
    if self._cell_editor is None:
        original_create_editor = delegate.createEditor
        def create_and_store_editor(instance, parent, option, target_index):
            self._cell_editor = original_create_editor(parent, option, target_index)
            return self._cell_editor
        delegate.createEditor = MethodType(create_and_store_editor, delegate)
    view.setCurrentIndex(index)
    view.edit(index)
    if self._cell_editor is None:
        # Native editor widget is being used, fall back to setting value directly in model.
        view.model().setData(index, value)
        return
    if isinstance(self._cell_editor, SearchBarEditor):
        key_press_event = QKeyEvent(QEvent.KeyPress, Qt.Key_Down, Qt.NoModifier, 0, 0, 0)
        i = 0
        while self._cell_editor.data() != value:
            if i == self._cell_editor._model.rowCount():
                raise RuntimeError("Value not found in editor widget.")
            self._cell_editor.keyPressEvent(key_press_event)
            i += 1
    else:
        self._cell_editor.setText(str(value))
    delegate.commitData.emit(self._cell_editor)
    delegate.closeEditor.emit(self._cell_editor)