Attempting to fix string parsing error in Python 2.6 for templates.py