def template_global(self, name: Optional[str]=None) -> Callable:
        """Add a template global.

        This is designed to be used as a decorator. An example usage,

        .. code-block:: python

            @app.template_global('name')
            def five():
                return 5

        Arguments:
            name: The global name (defaults to function name).
        """
        def decorator(func: Callable) -> Callable:
            self.add_template_global(func, name=name)
            return func
        return decorator