py3k compatibility

 - Bodies actually as bytes in test suite
 - use StringIO or BytesIO depending on python version :(