def METHOD_NAME(self, event):
    if event.isAccepted():
        return
    # It is necessary to use here the text of the event and not the key
    # to avoid issues with international keyboards.
    # See spyder-ide/spyder#9749
    char = event.text()
    if char in self.BRACKETS_CHAR and self.enabled:
        self.editor.completion_widget.hide()
        self._autoinsert_brackets(char)
        event.accept()