Something
public text v1 · immutable <py:def function="test_function()">foo</py:def>
<div>
<py:choose>
<py:when test="test_function() == 'foo'">
${test_function()}
</py:when>
<py:otherwise>not foo</py:otherwise>
</py:choose>
</div>