def template_global(self,
                        arg: Optional[Callable] = None,
                        *,
                        name: Optional[str] = None,
                        pass_context: bool = False,
                        inject: Optional[Union[bool, Iterable[str]]] = None,
                        safe: bool = False,
                        ) -> Callable:
        """
        Decorator to mark a function as a Jinja template global (tag).

        :param name: The name of the tag, if different from the function name.
        :param pass_context: Whether or not to pass the template context into the tag.
            If ``True``, the first argument must be the context.
        :param inject: Whether or not this tag needs any dependencies injected.
        :param safe: Whether or not to mark the output of this tag as html-safe.
        """
        def wrapper(fn):
            fn = _inject(fn, inject)
            if safe:
                fn = _make_safe(fn)
            if pass_context:
                fn = jinja2.contextfunction(fn)
            self._defer(lambda app: app.add_template_global(fn, name=name))
            return fn

        if callable(arg):
            return wrapper(arg)
        return wrapper
Decorator to mark a function as a Jinja template global (tag).

        :param name: The name of the tag, if different from the function name.
        :param pass_context: Whether or not to pass the template context into the tag.
            If ``True``, the first argument must be the context.
        :param inject: Whether or not this tag needs any dependencies injected.
        :param safe: Whether or not to mark the output of this tag as html-safe.