def write(self, data):
    if not self.__entered:
      raise Exception("RecordWriter should be used only with 'with' statement.")
    block_remaining = BLOCK_SIZE - self.__position % BLOCK_SIZE

    if block_remaining < HEADER_LENGTH:

      self.__writer.write('\x00' * block_remaining)
      self.__position += block_remaining
      block_remaining = BLOCK_SIZE

    if block_remaining < len(data) + HEADER_LENGTH:
      first_chunk = data[:block_remaining - HEADER_LENGTH]
      self.__write_record(RECORD_TYPE_FIRST, first_chunk)
      data = data[len(first_chunk):]

      while True:
        block_remaining = BLOCK_SIZE - self.__position % BLOCK_SIZE
        if block_remaining >= len(data) + HEADER_LENGTH:
          self.__write_record(RECORD_TYPE_LAST, data)
          break
        else:
          chunk = data[:block_remaining - HEADER_LENGTH]
          self.__write_record(RECORD_TYPE_MIDDLE, chunk)
          data = data[len(chunk):]
    else:
      self.__write_record(RECORD_TYPE_FULL, data)
same as `DagNode.getInstances` with includeSelf=False.
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/api/files/records.py/RecordsWriter.write--crossover with--dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/core/nodetypes.py/DagNode.getOtherInstances