fixed python 2/3 portability of StringIO import