code: def get_source_from_desc(source_descs):
      if source_descs.kind == SourceKind.CALLABLE:
          return CallableSource(source_descs)
      elif source_descs.kind in (
          SourceKind.ITERABLE,
          SourceKind.GENERATOR_FUNC,
      ):
          return IterableSource(source_descs)
      raise RuntimeError("Unsupported source type")
  
imports: from typing import List, Optional, Tuple
  import threading
  import traceback
  import socket
  from collections import deque
  from multiprocessing import reduction
  from nvidia.dali._utils.external_source_impl import SourceKind, _is_generator_function
  from nvidia.dali._multiproc.shared_batch import SharedBatchWriter, SharedBatchMeta, BufShmChunk, assert_valid_data_type, read_shm_message, write_shm_message
  from nvidia.dali._multiproc.messages import CompletedTask, WorkerArgs, ShmMessageDesc, ScheduledTask
  from nvidia.dali._multiproc.shared_queue import Dispatcher
label_desc: Use image node_id 1 for calling a global function with example usage: get_source_from_desc(source_descs) and returns: CallableSource, IterableSource