Redirecting standard output from Python: another example