use six.BytesIO instead of StringIO

Signed-off-by: Doug Hellmann <doug.hellmann@gmail.com>