code: def get_callback_from_source(source, cycle, batch_info=False):
      """Repack the source into a unified callback function. Additionally prepare
      the SourceDescription.
  
      `batch_info` is usable only with callables.
  
      Returns
      -------
      callback, SourceDescription
      """
      iterable = False
      desc = None
      if source is not None:
          try:
              if _cycle_enabled(cycle):
                  if inspect.isgenerator(source):
                      raise TypeError(
                          "Cannot cycle through a generator - if the generator is "
                          "a result of calling a generator function, "
                          "pass that function instead as `source`."
                      )
                  if _is_generator_function(source):
                      # We got a generator function, each call returns new "generator iterator"
                      desc = SourceDescription(
                          source,
                          SourceKind.GENERATOR_FUNC,
                          False,
                          cycle,
                      )
                      iterator = iter(_CycleGenFunc(source, cycle))
                  else:
                      # We hopefully got an iterable, iter(source) should return new iterator.
                      # TODO(klecki): Iterators are self-iterable (they return self from `iter()`),
                      #               add a check if we have iterable and not iterator here,
                      #               so we can better support cycle.
                      desc = SourceDescription(
                          source, SourceKind.ITERABLE, False, cycle
                      )
                      iterator = iter(_CycleIter(source, cycle))
              else:
                  # In non-cycling case, we go over the data once.
                  if _is_generator_function(source):
                      # If we got a generator, we extract the "generator iterator"
                      desc = SourceDescription(
                          source,
                          SourceKind.GENERATOR_FUNC,
                          False,
                          cycle,
                      )
                      source = source()
                  else:
                      desc = SourceDescription(
                          source, SourceKind.ITERABLE, False, cycle
                      )
  
                  # We try to use the iterable/iterator.
                  # If this is callable instead, we will throw an error containing 'not iterable'
                  # in the error message.
                  iterator = iter(source)
              iterable = True
              callback = lambda: next(iterator)  # noqa E731
          except TypeError as err:
              if "not iterable" not in str(err):
                  raise err
              if cycle is not None:
                  raise ValueError(
                      "The argument `cycle` can only be specified "
                      "if `source` is iterable"
                  )
              if not callable(source):
                  raise TypeError(
                      "Source must be callable, "
                      "iterable or a parameterless generator function"
                  )
              # We got a callable
              desc = SourceDescription(
                  source,
                  SourceKind.CALLABLE,
                  accepted_arg_count(source) > 0,
                  cycle,
                  batch_info,
              )
              callback = source
      else:
          desc = None
          callback = None
  
      if not iterable and cycle:
          raise ValueError(
              "`cycle` argument is only valid for iterable `source`"
          )
      return callback, desc
  
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 9 for calling a global function with example usage: get_callback_from_source(source, cycle, batch_info) and returns: callback,  desc