code: def truncate(v: str, *, max_len: int = 80) -> str:
      
      if isinstance(v, str) and len(v) > (max_len - 2):
          # -3 so quote + string + … + quote has correct length
          return repr(v[: (max_len - 3)] + '…')
      v = repr(v)
      if len(v) > max_len:
          v = v[: max_len - 1] + '…'
      return v
docs: Truncate a value and add a unicode ellipsis (three dots) to the end if it was too long