@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]))
 if isinstance(format_string, str):
  format_string = unicode(format_string)
 return jinja2.Markup(format_string.format(*args, **kwargs))

@ 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 ] ) ) if isinstance ( format_string , str ) : format_string = unicode ( format_string ) return jinja2 . Markup ( format_string . format ( * args , ** kwargs ) )
format a safe string with potentially unsafe arguments .