class_docstr: SharedBatchWriter can serialize and write batch into given shared
  memory chunk (``shm_chunk``).
code: def _write_batch(self, batch):
      if not batch:
          return
      batch = [
          _apply_to_sample(
              lambda x: _sample_to_numpy(x, _sample_error_msg), sample
          )
          for sample in batch
      ]
      meta, data_size = self._prepare_samples_meta(batch)
      serialized_meta = pickle.dumps(meta)
      self.meta_data_size = len(serialized_meta)
      self.data_size = _align_up(data_size, self.SAMPLE_ALIGNMENT)
      self.total_size = _align_up(
          self.data_size + self.meta_data_size, self.SAMPLE_ALIGNMENT
      )
      if self.shm_chunk.capacity < self.total_size:
          resize_shm_chunk(
              self.shm_chunk, self.total_size + self.min_trailing_offset
          )
      memview = self.shm_chunk.buf
      for sample, sample_meta in zip(batch, meta):
          _apply_to_sample(
              self._add_array_to_batch,
              sample,
              sample_meta,
              memview,
              nest_with_sample=1,
          )
      # copy meta data at the end of shared memory chunk
      buffer = memview[
          self.data_size : (self.data_size + self.meta_data_size)
      ]
      buffer[:] = serialized_meta
  
imports: import os
  from nvidia.dali._multiproc import shared_mem
  from nvidia.dali._multiproc.messages import ShmMessageDesc
  from nvidia.dali._utils.external_source_impl import assert_cpu_sample_data_type, sample_to_numpy
  import pickle
label_desc: Use image node_id 4 for calling the SharedBatchWriter obj's underlying member method code with example usage: obj._write_batch(batch) without return types