Conditional import of StringIO for python 3