python redirect sys.stdout