<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def highlight_matching_symbols_pairs(editor):
 """ Highlights given editor matching pairs. :param editor: Document editor. :type editor: QWidget :return: Method success. :rtype: bool """


    format = editor.language.theme.get("accelerator.pair")
    if not format:
        return False

    extra_selections = editor.extraSelections() or []
    if not editor.isReadOnly():
        start_selection = QTextEdit.ExtraSelection()
        start_selection.format.setBackground(format.background())
        end_selection = QTextEdit.ExtraSelection()
        end_selection.format.setBackground(format.background())

        cursor = editor.textCursor()
        if cursor.hasSelection():
            text = foundations.strings.to_string(cursor.selectedText())
        else:
            cursor.movePosition(QTextCursor.PreviousCharacter, QTextCursor.KeepAnchor)
            text = foundations.strings.to_string(cursor.selectedText())

        start_selection.cursor = cursor

        if text in editor.language.symbols_pairs.keys():
            extra_selections.append(start_selection)
            end_selection.cursor = editor.get_matching_symbols_pairs(cursor,
                                                                     text,
                                                                     editor.language.symbols_pairs[text])
        elif text in editor.language.symbols_pairs.values():
            extra_selections.append(start_selection)
            end_selection.cursor = editor.get_matching_symbols_pairs(cursor,
                                                                     text,
                                                                     editor.language.symbols_pairs.get_first_key_from_value(
                                                                         text),
                                                                     True)
        else:
            return False

        extra_selections.append(end_selection)
    editor.setExtraSelections(extra_selections)
    return True