<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fail_on_template_errors(f, *args, **kwargs):
 """ Decorator that causes templates to fail on template errors. """

    decorators = [
        _fail_template_string_if_invalid,
        _always_strict_resolve,
        _disallow_catching_UnicodeDecodeError,
    ]
    if django.VERSION < (1, 8):
        decorators.append(_patch_invalid_var_format_string)

    return reduce(__apply, decorators, f)(*args, **kwargs)