code: def deserialize_sample(buffer: BufShmChunk, sample):
      if isinstance(sample, SampleMeta):
          offset = sample.offset
          assert (
              offset % sample.dtype.itemsize == 0
          ), "Sample offset is misaligned."
          buffer = buffer.buf[offset : offset + sample.nbytes]
          return np.ndarray(
              sample.shape, dtype=sample.dtype, buffer=buffer
          )
      if isinstance(
          sample,
          (
              tuple,
              list,
          ),
      ):
          return type(sample)(
              deserialize_sample(buffer, part) for part in sample
          )
      return sample
  
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 a global function with example usage: deserialize_sample(buffer, sample) and returns: sample, np, type