PY3: Use io.open to write bytes in python 2/3