Replace StringIO module with io