Well, this is the old way of doing templates with Python.

I'm not sure if it's worth to move over to the new way but it might be worth at least to consider it.