Fix jinjaext compatibility with Python 3

I'm resending the patch from Arfrever for issue #115 because it seems that it has been missed because of the issue being closed.