Helper to include in your own templatetag, for static TemplateHooks

    Example::

        import myhooks
        from hooks.templatetags import template_hook_collect

        @register.simple_tag(takes_context=True)
        def hook(context, name, *args, **kwargs):
            return template_hook_collect(myhooks, name, context, *args, **kwargs)

    :param module module: Module containing the template hook definitions
    :param str hook_name: The hook name to be dispatched
    :param \*args: Positional arguments, will be passed to hook callbacks
    :param \*\*kwargs: Keyword arguments, will be passed to hook callbacks
    :return: A concatenation of all callbacks\
    responses marked as safe (conditionally)
    :rtype: str

def template_hook_collect(module, hook_name, *args, **kwargs):
    """
    Helper to include in your own templatetag, for static TemplateHooks

    Example::

        import myhooks
        from hooks.templatetags import template_hook_collect

        @register.simple_tag(takes_context=True)
        def hook(context, name, *args, **kwargs):
            return template_hook_collect(myhooks, name, context, *args, **kwargs)

    :param module module: Module containing the template hook definitions
    :param str hook_name: The hook name to be dispatched
    :param \*args: Positional arguments, will be passed to hook callbacks
    :param \*\*kwargs: Keyword arguments, will be passed to hook callbacks
    :return: A concatenation of all callbacks\
    responses marked as safe (conditionally)
    :rtype: str
    """
    try:
        templatehook = getattr(module, hook_name)
    except AttributeError:
        return ""

    return format_html_join(
        sep="\n",
        format_string="{}",
        args_generator=(
            (response, )
            for response in templatehook(*args, **kwargs)
        )
    )