def widont_html(value):
 def replace(matchobj):
  return (u'%s&nbsp;%s%s' % matchobj.groups())
 return re_widont_html.sub(replace, force_unicode(value))

def widont_html ( value ) : def replace ( matchobj ) : return ( u'%s&nbsp;%s%s' % matchobj . groups ( ) ) return re_widont_html . sub ( replace , force_unicode ( value ) )
adds an html non-breaking space between the final two words at the end of block level tags to avoid "widowed" words .