Fix StringIO import in Python 3