Use right IO types for different Python versions.