code: def sampled_dataset(dataset_size, batch_size, ndim, dtype):
      """Returns a generator that returns random samples from a pre-generated dataset"""
      data = generate_samples(dataset_size, ndim, dtype)
  
      def gen():
          # batch_size = np.random.randint(1, max_batch_size+1)
          return [random.choice(data) for _ in range(batch_size)]
  
      return gen
  
imports: from nose_utils import assert_raises
  import nvidia.dali
  import nvidia.dali.fn
  import nvidia.dali.ops
  import numpy
  import scipy.ndimage
  import scipy.ndimage.measurements
  import random
  from test_utils import check_batch, np_type_to_dali
  from nose.tools import nottest
  from nose.plugins.attrib import attr
label_desc: Use image node_id 16 for calling a global function with example usage: sampled_dataset(dataset_size, batch_size, ndim, dtype) and returns: gen, unknown