See [this comment](https://github.com/python/cpython/issues/130148#issuecomment-2666553480) in the CPython repo outlining a possible design for a context manager that sets up per-thread output redirection. This could also live in a third-party project but I agree with Sam it probably makes sense to do here.