handlebar.py: tweak template parsing to make it much faster.