StringIO needs to be bytes