code: def shorten_string(string, max_width):
      ''' make limited length string in form:
        "the string is very lo...(and 15 more)"
      '''
      string_len = len(string)
      if string_len <= max_width:
          return string
      visible = max_width - 16 - int(log10(string_len))
      # expected suffix len "...(and XXXXX more)"
      if not isinstance(string, unistr):
          visstring = unistr(string[:visible], errors='ignore')
      else:
          visstring = string[:visible]
      return u''.join((visstring, u'...(and ',
                       unistr(string_len - visible), u' more)')f shorten_string(string, max_width):
      ''' make limited length string in form:
        "the string is very lo...(and 15 more)"
      '''
      string_len = len(string)
      if string_len <= max_width:
          return string
      visible = max_width - 16 - int(log10(string_len))
      # expected suffix len "...(and XXXXX more)"
      if not isinstance(string, unistr):
          visstring = unistr(string[:visible], errors='ignore')
      else:
          visstring = string[:visible]
      return u''.join((visstring, u'...(and ',
                       unistr(string_len - visible), u' more)'))
docs: make limited length string in form:
        "the string is very lo...(and 15 more)"