<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def eventFilter(self, watchedObject, event):
 """ Calls commitAndClose when the tab and back-tab are pressed. This is necessary because, normally the event filter of QStyledItemDelegate does this for us. However, that event filter works on this object, not on the sub editor. """

        if event.type() == QtCore.QEvent.KeyPress:
            key = event.key()
            if key in (Qt.Key_Tab, Qt.Key_Backtab):
                self.commitAndClose()
                return True
            else:
                return False

        return super(AbstractCtiEditor, self).eventFilter(watchedObject, event)