Prefix all "reserved" names used by the template system with _tt_
to avoid collisions with user-defined names.

Inspired by #768.
Fix locale.format_date on python 3.

There's probably more work to be done on this largely-untested code,
but this was the case I could find by grepping for stray references
to `long`.