Fix jinjaext compatibility with Python 3.

Patch by Arfrever.

Fixes: https://github.com/mitsuhiko/jinja2/issues/115
Merge pull request #171 from mgorny/master

Fix jinjaext compatibility with Python 3