Lexer and codec to work with LaTeX code in Python