Work atop Python3 by using io.BytesIO rather than compat2and3 module.