human
Complete the below
def create_lexer(base_class):

    ''''Subclass the pygments RegexLexer to lex line by line instead of lexing full
    text. The statestack at the end of each line is stored in the Qt block state.'
    '''
 ... Write me a the Python code you requested?
assistant
#Here is the Python code you requested.
    def get_tokens_unprocessed(self, text, statestack):
        pos = 0
        tokendefs = self._tokens
        statetokens = tokendefs[statestack[(-1)]]
        while True:
            for (rexmatch, action, new_state) in statetokens:
                m = rexmatch(text, pos)
                if (m is not None):
                    if (action is not None):
                        if (type(action) is _TokenType):
                            (yield (pos, action, m.group()))
                        else:
                            for item in action(self, m):
                                (yield item)
                    pos = m.end()
                    if (new_state is not None):
                        if isinstance(new_state, tuple):
                            for state in new_state:
                                if (state == u'#pop'):
                                    statestack.pop()
                                elif (state == u'#push'):
                                    statestack.append(statestack[(-1)])
                                else:
                                    statestack.append(state)
                        elif isinstance(new_state, int):
                            del statestack[new_state:]
                        elif (new_state == u'#push'):
                            statestack.append(statestack[(-1)])
                        else:
                            assert False, (u'wrong    state    def:    %r' % new_state)
                        statetokens = tokendefs[statestack[(-1)]]
                    break
            else:
                try:
                    if (text[pos] == u'\n'):
                        statestack[:] = [u'root']
                        break
                    (yield (pos, Error, text[pos]))
                    pos += 1
                except IndexError:
                    break
    def lex_a_line(self, state, text, i, formats_map, user_data):
        u'    Get    formats    for    a    single    block    (line)    '
        statestack =...