<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def autoescape(context, nodelist, setting):
 """ Force autoescape behaviour for this block. """

    old_setting = context.autoescape
    context.autoescape = setting
    output = nodelist.render(context)
    context.autoescape = old_setting
    if setting:
        return mark_safe(output)
    else:
        return output