<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def TemplateValidator(value):
 """Try to compile a string into a Django template"""


    try:
        Template(value)
    except Exception as e:
        raise ValidationError(
            _("Cannot compile template (%(exception)s)"),
            params={"exception": e}
        )