@register.filter
def break_long_headers(header):
 if ((len(header) > 160) and (u',' in header)):
  header = mark_safe((u'<br> ' + u', <br>'.join(header.split(u','))))
 return header

@ register . filter def break_long_headers ( header ) : if ( ( len ( header ) > 160 ) and ( u',' in header ) ) : header = mark_safe ( ( u'<br> ' + u', <br>' . join ( header . split ( u',' ) ) ) ) return header
breaks headers longer than 160 characters when possible .