Maybe for the future, and just as a suggestion, what about using something like [mako](http://www.makotemplates.org/) for this :-)