def get_template(self, template_name: str) -> Template:
        """
        Get a template by name, loading from file if not already cached.

        Args:
            template_name: The name of the template file (e.g., "header.j2")

        Returns:
            A Jinja2 Template object
        """
        if template_name not in self._templates:
            try:
                self._templates[template_name] = self.env.get_template(template_name)
            except Exception as e:
                logging.error(f"Error loading template {template_name}: {e}")
                # Return a simple default template as fallback
                return Template("Template loading error")

        return self._templates[template_name]

        Get a template by name, loading from file if not already cached.

        Args:
            template_name: The name of the template file (e.g., "header.j2")

        Returns:
            A Jinja2 Template object
        
src/robusta/core/sinks/slack/templates/template_loader.py