add useful reprs for djdt/pdb etc.
mutate parsed_template into a sorteddict, for ordering stability on python3.