code: def __init__(self, datadir, gen, chunksize, fs, do_pickle=True):
      self.datadir = datadir
      self.gen = gen
      assert gen >= 0
      # Threshold should be number of elements or chunksize?
      self.chunksize = chunksize
      assert chunksize > 0
      self.do_pickle = do_pickle
      self.fs = fs
  
      # AppendOnly
      self.indexfile = os.path.join(
          datadir, _INDEX_FILENAME_FORMAT.format(gen)
      )
      self.ifp = self.fs.open(self.indexfile, "wb")
      self.datafile = os.path.join(
          datadir, _DATA_FILENAME_FORMAT.format(gen)
      )
      self.dfp = self.fs.open(self.datafile, "wb")
  
      self.offset = 0
      self.full = self.chunksize < self.offset
  
imports: import binascii
  import collections
  import os
  import pickle
  from datetime import datetime
  from struct import calcsize, pack, unpack
  from pfrl.collections.random_access_queue import RandomAccessQueue
label_desc: Use image node_id 1 to create a new _ChunkWriter object from inherited base classes: object with example: obj = _ChunkWriter(datadir, gen, chunksize, fs, do_pickle)