<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def template_to_text(tmpl, debug=0):
 """ convert parse tree template to text """

    tarr = []
    for item in tmpl.itertext():
        tarr.append(item)

    text = "{{%s}}" % "|".join(tarr).strip()

    if debug > 1:
        print("+ template_to_text:")
        print("  %s" % text)

    return text