PyLaTeX appears to have a TeX parser (and much more!) written in Python,
and it's at
http://pylatex.sourceforge.net/
I'm not sure of the licence. I guess if we restrict the macros to a
"safe" set, we shouldn't need any more than the lexical analyser.
Neil