code: def external_source_tester(
      shape,
      dtype,
      source=None,
      external_source_device="cpu",
      no_copy=None,
      batch=False,
  ):
      def get_external_source_pipeline_getter(
          batch_size,
          num_threads,
          device,
          device_id=0,
          shard_id=0,
          num_shards=1,
          def_for_dataset=False,
      ):
          pipe = one_input_pipeline(
              def_for_dataset,
              device,
              source,
              external_source_device,
              batch_size=batch_size,
              num_threads=num_threads,
              device_id=device_id,
              no_copy=no_copy,
              batch=batch,
          )
  
          batch_shape = (batch_size,) + tuple(None for _ in shape)
  
          return (
              pipe,
              (batch_shape, batch_shape),
              (tf.dtypes.as_dtype(dtype), tf.int32),
          )
  
      return get_external_source_pipeline_getter
  
imports: import numpy
  import nvidia.dali
  import nvidia.dali.fn
  import nvidia.dali.plugin.tf
  import tensorflow
  from nose.tools import nottest
  from nvidia.dali import pipeline_def
  from test_utils import RandomlyShapedDataIterator
label_desc: Use image node_id 5 for calling a global function with example usage: external_source_tester(shape, dtype, source, external_source_device, no_copy, batch) and returns: get_external_source_pipeline_getter, pipe,  batch_shape,  batch_shape,  tf,  tf