Fix StringIO module import to support Python 3