code: def _shorten(s, prefixlen, suffixlen):
      skip = len(s) - prefixlen - suffixlen
      if skip > _PLACEHOLDER_LEN:
          s = "%s[%d chars]%s" % (
              s[:prefixlen],
              skip,
              s[len(s) - suffixlen :],
          )
      return s
  
file_path: cpython/Lib/unittest/util.py
imports: from collections import namedtuple, Counter
  from os.path import commonprefix
label_desc: Use image node_id 1 for calling a global function with example usage: _shorten(s, prefixlen, suffixlen) and returns: s