code: def _wrap_tracebackexception_format(redact: Callable[[str], str]):
      
      original_format = getattr(TracebackException, '_original', None)
      if original_format is None:
          original_format = TracebackException.format
          setattr(TracebackException, '_original', original_format)
  
      @wraps(original_format)
      def tracebackexception_format(self, *, chain=True):
          for line in original_format(self, chain=chain):
              yield redact(line)
  
      setattr(TracebackException, 'format', tracebackexception_format)
docs: Monkey-patch TracebackException.format to redact printed lines.
  
      Only the last call will be effective. Consecutive calls will overwrite the
      previous monkey patches.