Replace StringIO with BytesIO
Fix for python 3