code: def _write_wrapper(self, name):
          
          io_attr = getattr(self._io, name)
  
          def write_wrapper(*args, **kwargs):
              """Wrap all write calls to the stream object."""
              ret_value = io_attr(*args, **kwargs)
              if not IS_PY2:
                  return ret_value
  
          return write_wrapper
docs: Wrap write() to adapt return value for Python 2.
  
          Returns:
              Wrapper which is described below.