python 3 compatibility with StringIO