@register.filter(needs_autoescape=True)
def smartcoffee(value, autoescape=True):
 'and also detects surrounding autoescape on filter (if any) and escapes '
 if autoescape:
  value = escape(value)
 result = ('<b>%s</b>' % value)
 return mark_safe(result)

@ register . filter ( needs_autoescape = True ) def smartcoffee ( value , autoescape = True ) : if autoescape : value = escape ( value ) result = ( '<b>%s</b>' % value ) return mark_safe ( result )
returns input wrapped in html <b></b> tags .