human
I wrote the below code

    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 =...

What's a good function header?
assistant
#Here's a good function header.

def create_lexer(base_class):