def __call__(self, toktype, toktext, (srow,scol), (erow,ecol), line):
        style = ''
        # calculate new positions
        oldpos = self.pos
        newpos = self.lines[srow] + scol
        self.pos = newpos + len(toktext)

        # handle newlines
        if toktype in [token.NEWLINE, tokenize.NL]:
            self.out.write('\n')
            return

        # send the original whitespace, if needed
        if newpos > oldpos:
            self.out.write(self.raw[oldpos:newpos])

        # skip indenting tokens
        if toktype in [token.INDENT, token.DEDENT]:
            self.pos = newpos
            return

        # map token type to a color group
        if token.LPAR <= toktype and toktype <= token.OP:
            toktype = token.OP
        elif toktype == token.NAME and keyword.iskeyword(toktext):
            toktype = _KEYWORD

        # If the keyword is class or def then we set a flag
        # the next word gets set to the class/def name color.
        if self.ClassFlag or self.DefFlag:
            # Sets the color if it was a class or def name
            if self.ClassFlag:
                toktype = _CLASS
                self.ClassFlag = 0 
            elif self.DefFlag:
                toktype = _DEF
                self.DefFlag = 0
        else:
            # Sets a flag if it was a class or def
            # next token will be colored.
            if toktext =='class':
                self.ClassFlag = 1
            elif toktext == 'def':
                self.DefFlag = 1

        # Extended to seperate the diffrent string types..
        # plus raw and unicode types
        if toktype == token.STRING:
            if (toktext[:3] == "'''") or (
                toktext[:4] == "r'''") or (
                toktext[:4] == "u'''"):
                toktype = _TRIPLESINGLEQUOTE
            elif (toktext[:3] == '"""') or (
                   toktext[:4] == 'r"""') or (
                   toktext[:4] == 'u"""'):
                toktype = _TRIPLEDOUBLEQUOTE
            elif (toktext[:1] == '"') or (
                   toktext[:2] == 'r"') or (
                   toktext[:2] == 'u"'):
                toktype = _DOUBLEQUOTE
            elif (toktext[:1] == "'") or (
                   toktext[:2] == "r'") or (
                   toktext[:2] == "u'"):
                toktype = _SINGLEQUOTE

        # Exetended to seperate the diffrent comment types
        elif toktype == tokenize.COMMENT:
            if toktext[:2] == "##":
                toktype = _DOUBLECOMMENT

        # Get the colors from the dictionary for the standard tokens
        color = self.colors.get(toktype, self.colors[_TEXT])
        otherstart = ''
        otherend = ''
        splitpoint = color.find('#')
        tags = color[:splitpoint].lower()
        color = color[splitpoint:]
        
        # Check for styles and set them if needed..(b=bold, i=italics)
        if 'b' in tags:
            otherstart += '<b>'
            otherend += '</b>'
        if 'i' in tags:
            otherstart += '<i>'
            otherend += '</i>'
        if 'u' in tags:
            otherstart += '<u>'
            otherend += '</u>'

        # Error tokenizing ..red boxes
        if toktype == token.ERRORTOKEN:
            style = ' style="border: solid 1.5pt #FF0000;"'

        # send text
        self.out.write('<font color="%s"%s>%s' % (color, style, otherstart))
        self.out.write(cgi.escape(toktext))
        self.out.write('%s</font>'% (otherend,))
        return
Check if all items in list of lists are strings or numbers
dataset/ETHPy150Open anandology/pyjamas/examples/showcase/pyColourize.py/Parser.__call__--crossover with--dataset/ETHPy150Open j-bennet/wharfee/wharfee/formatter.py/is_plain_lists