<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def symbols_expanding_pre_event_input_accelerators(editor, event):
 """ Implements symbols expanding pre event input accelerators. :param editor: Document editor. :type editor: QWidget :param event: Event being handled. :type event: QEvent :return: Process event. :rtype: bool """


    process_event = True

    symbols_pairs = get_editor_capability(editor, "symbols_pairs")
    if not symbols_pairs:
        return process_event

    text = foundations.strings.to_string(event.text())
    if text in symbols_pairs:
        cursor = editor.textCursor()
        if not is_symbols_pair_complete(editor, text):
            cursor.insertText(event.text())
        else:
            if not cursor.hasSelection():
                cursor.insertText(event.text())
                # TODO: Provide an efficient code alternative.
                # position = cursor.position()
                # cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor)
                # selected_text = foundations.strings.to_string(cursor.selectedText())
                # cursor.setPosition(position)
                # if not selected_text.strip():
                cursor.insertText(symbols_pairs[text])
                cursor.movePosition(QTextCursor.Left, QTextCursor.MoveAnchor)
            else:
                selected_text = cursor.selectedText()
                cursor.insertText(event.text())
                cursor.insertText(selected_text)
                cursor.insertText(symbols_pairs[text])
        editor.setTextCursor(cursor)
        process_event = False

    if event.key() in (Qt.Key_Backspace,):
        cursor = editor.textCursor()
        cursor.movePosition(QTextCursor.Left, QTextCursor.KeepAnchor)
        left_text = cursor.selectedText()
        foundations.common.repeat(lambda: cursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor), 2)
        right_text = cursor.selectedText()

        if symbols_pairs.get(foundations.strings.to_string(left_text)) == foundations.strings.to_string(right_text):
            cursor.deleteChar()
    return process_event