> I used this code in my other projects, so I just included this one
> automatically. The reason to replace the stdout is because we can still use
> print instead of stderr.write.

But it's less explicite and has side effects.