def METHOD_NAME(app_obj):
    # NOTE: do not reference the session, request, or g objects in
    # template functions. It will raise an error when called outside
    # of a request context (for example when sending emails from a
    # command line job)
    init_preload(app_obj)
    @app_obj.template_filter("time_ago")
    def time_ago(date):
        return pendulum.instance(date).diff_for_humans()
    @app_obj.template_filter("iban")
    def format_iban(iban):
        return " ".join(wrap(iban, 4))
    @app_obj.template_filter("sort_code")
    def format_sort_code(sort_code):
        return "-".join(wrap(sort_code, 2))
    @app_obj.template_filter("price")
    def format_price(price, currency=None, after=False):
        if isinstance(price, Price):
            currency = price.currency
            amount = price.value
            # TODO: look up after from CURRENCIES
        else:
            amount = price
        amount = "{0:.2f}".format(amount)
        symbol = CURRENCY_SYMBOLS[currency]
        if after:
            return amount + symbol
        return symbol + amount
    @app_obj.template_filter("bankref")
    def format_bankref(bankref):
        return "%s-%s" % (bankref[:4], bankref[4:])
    @app_obj.context_processor
    def utility_processor():
        SALES_STATE = get_sales_state()
        SITE_STATE = get_site_state()
        return dict(
            SALES_STATE=SALES_STATE,
            SITE_STATE=SITE_STATE,
            CURRENCIES=CURRENCIES,
            CURRENCY_SYMBOLS=CURRENCY_SYMBOLS,
            external_url=external_url,
            feature_enabled=feature_enabled,
            get_user_currency=get_user_currency,
            year=datetime.utcnow().year,
        )
    @app_obj.context_processor
    def event_date_processor():
        def suffix(d):
            return (
                "th" if 11 <= d <= 13 else {1: "st", 2: "nd", 3: "rd"}.get(d % 10, "th")
            )
        s = event_start()
        e = event_end()
        assert s.year == e.year
        if s.month == e.month:
            fancy_dates = f"""{s.strftime('%B')}<span style="white-space: nowrap">
                {s.day}<sup>{suffix(s.day)}</sup>&ndash;{e.day}<sup>{suffix(e.day)}</sup>
                {s.year}
                </span>"""
            simple_dates = f"{s.day}&ndash;{e.day} {s.strftime('%B')}"
        else:
            fancy_dates = f"""{s.strftime("%B")}
                {s.day}<sup>{suffix(s.day)}</sup>&ndash;{e.strftime("%B")}
                {e.day}<sup>{suffix(e.day)}</sup>"""
            simple_dates = (
                f"""{s.day} {s.strftime("%B")}&ndash;{e.day} {e.strftime("%B")}"""
            )
        return {
            "fancy_dates": Markup(fancy_dates),
            "simple_dates": Markup(simple_dates),
            "event_start": s,
            "event_end": e,
            "event_year": s.year,
        }
    @app_obj.context_processor
    def octicons_processor():
        def octicon(name, **kwargs):
            cls_list = kwargs.get("class", [])
            if type(cls_list) != list:
                cls_list = list(cls_list)
            classes = " ".join(cls_list)
            alt = kwargs.get("alt", name)
            return Markup(
                f'<img src="/static/icons/{name}.svg" class="octicon {classes}" alt="{alt}">'
            )
        return {"octicon": octicon}
    @app_obj.template_filter("pretty_text")
    def pretty_text(text):
        text = text.strip(" \n\r")
        text = urlize(text, trim_url_limit=40)
        text = "\n".join(f"<p>{para}</p>" for para in re.split(r"[\r\n]+", text))
        return Markup(text)