code: def _get_generator_from_source_desc(
      source_desc: SourceDescription, batch_size, is_batched
  ):
      """Based on DALI source description create a generator function, type and shape specification
      compatible with TF Generator Dataset.
  
      Cycling is delegated to the dataset as some control of some cycling behavior cannot be
      realized in TF.
      """
      if source_desc.kind == SourceKind.CALLABLE:
          if source_desc.has_inputs:
              if is_batched:
                  return get_batch_iterable_from_callback(source_desc)
              else:
                  return get_sample_iterable_from_callback(
                      source_desc, batch_size
                  )
          else:
              # No inputs, plain iteration
              return get_iterable_from_callback(source_desc, is_batched)
      else:
          # Generator Func or iterable
          return get_iterable_from_iterable_or_generator(
              source_desc, is_batched
          )
  
imports: from enum import Enum
  from nvidia.dali import types
  from nvidia.dali import tensors
  import inspect
  import functools
label_desc: Use image node_id 15 for calling a global function with example usage: _get_generator_from_source_desc(source_desc, batch_size, is_batched) and returns: get_iterable_from_iterable_or_generator, get_iterable_from_callback, get_batch_iterable_from_callback, get_sample_iterable_from_callback