def _smart_truncate(content, length=100, suffix='...'):
 if (len(content) <= length):
  return content
 return (content[:length].rsplit(' ', 1)[0] + suffix)

def _smart_truncate ( content , length = 100 , suffix = '...' ) : if ( len ( content ) <= length ) : return content return ( content [ : length ] . rsplit ( ' ' , 1 ) [ 0 ] + suffix )
smart truncate .