docs: def write(self, data, multithread=True, **kwargs):
          '''
          :param data: Data to be written
          :type data: str or mmap object
          :param multithread: If True, sends multiple write requests asynchronously
          :type multithread: boolean
  
          Writes the data *data* to the file.
  
          .. note::
  
              Writing to remote files is append-only. Using :meth:`seek`
              does not affect where the next :meth:`write` will occur.
  
          '''
          if USING_PYTHON2:
              self._write2(data, multithread=multithread, **kwargs)
          else:
              # In python3, the underlying system methods use the 'bytes' type, not 'string'
              #
              # This is, hopefully, a temporary hack. It is not a good idea for two reasons:
              # 1) Performance, we need to make a pass on the data, and need to allocate
              #    another buffer of similar size
              # 2) The types are wrong. The "bytes" type should be visible to the caller
              #    of the write method, instead of being hidden.
  
              # Should we throw an exception if the file is opened in binary mode,
              # and the data is unicode/text?
              if isinstance(data, str):
                  bt = data.encode("utf-8")
              elif isinstance(data, bytearray):
                  bt = bytes(data)
              elif isinstance(data, bytes):
                  bt = data
              elif isinstance(data, mmap.mmap):
                  bt = bytes(data)
              else:
                  raise DXFileError("Invalid type {} for write data argument".format(type(data)))
              assert(isinstance(bt, bytes))
              self._write2(bt, multithread=multithread, **kwargs)