Simplify template.py.