Revert "Do os.platform() check only once."

This reverts commit a7616ed1b824f7e9b52e88db3d6a9dc21242805d.