correct way to do StringIO on python3
s/StringIO/BytesIO/g
force bytes on writes