@library.filter
def fe(format_string, *args, **kwargs):

    args = [jinja2.escape(smart_text(v)) for v in args]

    for k in kwargs:
        kwargs[k] = jinja2.escape(smart_text(kwargs[k]))

    # Jinja will sometimes give us a str and other times give a unicode
    # for the `format_string` parameter, and we can't control it, so coerce it here.
    if isinstance(format_string, str):  # not unicode
        format_string = unicode(format_string)

    return jinja2.Markup(format_string.format(*args, **kwargs))
Format a safe string with potentially unsafe arguments. returns a safe string.
dataset/ETHPy150Open mozilla/kitsune/kitsune/sumo/templatetags/jinja_helpers.py/fe