code: def tracemessage(self, maxlen=6):
          
          result = ""
          for i, value in enumerate(self):
              result += "{0}: {1}\n".format(i, get_node_repr(value))
  
          result = result.strip("\n")
          lines = result.split("\n")
  
          if maxlen and len(lines) > maxlen:
              i = int(maxlen / 2)
              lines = lines[:i] + ["..."] + lines[-(maxlen - i) :]
              result = "\n".join(lines)
  
          return result
docs: if maxlen > 0, the message is shortened to maxlen traces.