<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_string(self, template_code):
 """ Trying to compile and return the compiled template code. :raises: TemplateSyntaxError if there's a syntax error in the template. :param template_code: Textual template source. :return: Returns a compiled Mako template. """

        try:
            return self.template_class(self.engine.from_string(template_code))
        except mako_exceptions.SyntaxException as exc:
            raise TemplateSyntaxError(exc.args)