1👍
Tornado’s template system does not support defining multi-line functions inside the template. In simple cases you can use {% set f = lambda... %}
but all other functions must come from outside the template (either passed in via the namespace or imported within the template with the {% import %}
directive).
Source:stackexchange.com