@register.filter(is_safe=True)
def stringformat(value, arg):
 try:
  return ((u'%' + six.text_type(arg)) % value)
 except (ValueError, TypeError):
  return u''

@ register . filter ( is_safe = True ) def stringformat ( value , arg ) : try : return ( ( u'%' + six . text_type ( arg ) ) % value ) except ( ValueError , TypeError ) : return u''
formats the variable according to the arg .