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.

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)