code: def safe_repr(self, obj):
          
          try:
              return repr(obj)
          except Exception as e:
              return '??? Broken repr (%s: %s)' % (type(e).__name__, e)
docs: Like a repr but without exception