<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _symbol_extract(self, regex, plus = True, brackets=False):
 """Extracts a symbol or full symbol from the current line, optionally including the character under the cursor. :arg regex: the compiled regular expression to use for extraction. :arg plus: when true, the character under the cursor *is* included. :arg brackets: when true, matching pairs of brackets are first removed before the regex is run. """

        charplus = self.pos[1] + (1 if plus else -1)
        consider = self.current_line[:charplus][::-1]

        #We want to remove matching pairs of brackets so that derived types
        #that have arrays still get intellisense.
        if brackets==True:
            #The string has already been reversed, just run through it.
            rightb = []
            lastchar = None
            for i in range(len(consider)):
                if consider[i] == ")":
                    rightb.append(i)
                elif consider[i] == "(" and len(rightb) > 0:
                    lastchar = i
                    rightb.pop()

            if lastchar is not None:
                consider = '%' + consider[lastchar+1:]

        rematch = regex.match(consider)
        if rematch is not None:
            return rematch.group("symbol")[::-1]
        else:
            return ""