'Convert the given token string into a new Token object and return it.
If in_tag is True, we are processing something that matched a tag,
otherwise it should be treated as a literal string.'

def create_token(self, token_string, in_tag):

    if (in_tag and token_string.startswith(BLOCK_TAG_START)):
        block_content = token_string[2:(-2)].strip()
        if (self.verbatim and (block_content == self.verbatim)):
            self.verbatim = False
    if (in_tag and (not self.verbatim)):
        if token_string.startswith(VARIABLE_TAG_START):
            token = Token(TOKEN_VAR, token_string[2:(-2)].strip())
        elif token_string.startswith(BLOCK_TAG_START):
            if (block_content[:9] in (u'verbatim', u'verbatim    ')):
                self.verbatim = (u'end%s' % block_content)
            token = Token(TOKEN_BLOCK, block_content)
        elif token_string.startswith(COMMENT_TAG_START):
            content = u''
            if token_string.find(TRANSLATOR_COMMENT_MARK):
                content = token_string[2:(-2)].strip()
            token = Token(TOKEN_COMMENT, content)
    else:
        token = Token(TOKEN_TEXT, token_string)
    token.lineno = self.lineno
    self.lineno += token_string.count(u'\n')
    return token
