code: def write_shm_message(
      worker_id, shm_chunk: BufShmChunk, message, offset, resize=True
  ):
      """
      Pickles `message` instances, stores it in the provided `shm` chunk at given offset and returns
      `ShmMessageDesc` instance describing the placement of the `message`.
      Returned instance can be put into ShmQueue.
      """
      serialized_message = pickle.dumps(message)
      num_bytes = len(serialized_message)
      if num_bytes > shm_chunk.capacity - offset:
          if resize:
              resize_shm_chunk(shm_chunk, offset + num_bytes)
          else:
              # This should not happen, resize is False only when writing task description into memory
              # in the main process, and the description (ScheduledTask and its members) boils down
              # to bounded number of integers.
              raise RuntimeError(
                  "Could not put message into shared memory region,"
                  " not enough space in the buffer."
              )
      buffer = shm_chunk.buf[offset : offset + num_bytes]
      buffer[:] = serialized_message
      return ShmMessageDesc(
          worker_id,
          shm_chunk.shm_chunk_id,
          shm_chunk.capacity,
          offset,
          num_bytes,
      )
  
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 11 for calling a global function with example usage: write_shm_message(worker_id, shm_chunk, message, offset, resize) and returns: ShmMessageDesc