How can I do an atomic write to stdout in python?,sys.stdout.write(msg)