code: def safe_better_repr(
              self, obj, context=None, html=True, level=0, full=False
      ):
          
          context = context and dict(context) or {}
          recursion = id(obj) in context
          if not recursion:
              context[id(obj)] = obj
              try:
                  rv = self.better_repr(obj, context, html, level + 1, full)
              except Exception:
                  rv = None
              if rv:
                  return rv
  
          self.obj_cache[id(obj)] = obj
          if html:
              return '<a href="%d" class="inspect">%s%s</a>' % (
                  id(obj), 'Recursion of '
                  if recursion else '', escape(self.safe_repr(obj))
              )
          return '%s%s' % (
              'Recursion of ' if recursion else '', self.safe_repr(obj)
          )
docs: Repr with inspect links on objects