def _WritePartial(self, data):

    chunk = self.offset / self.chunksize
    chunk_offset = self.offset % self.chunksize
    data = utils.SmartStr(data)

    available_to_write = min(len(data), self.chunksize - chunk_offset)

    fd = self._GetChunkForWriting(chunk)
    fd.seek(chunk_offset)

    fd.write(data[:available_to_write])
    self.offset += available_to_write

    return data[available_to_write:]
Writes at most one chunk of data.
dataset/ETHPy150Open google/grr/grr/lib/aff4.py/AFF4ImageBase._WritePartial