def widont(value, count=1):
 def replace(matchobj):
  return force_text(('&nbsp;%s' % matchobj.group(1)))
 for i in range(count):
  value = re_widont.sub(replace, force_text(value))
 return value

def widont ( value , count = 1 ) : def replace ( matchobj ) : return force_text ( ( '&nbsp;%s' % matchobj . group ( 1 ) ) ) for i in range ( count ) : value = re_widont . sub ( replace , force_text ( value ) ) return value
adds an html non-breaking space between the final two words of the string to avoid "widowed" words .