code: def random_classes(background):
      def get_classes():
          tmp = list(np.flatnonzero(np.random.random([10]) > 0.5))
          try:
              tmp.remove(background)
          except ValueError:
              pass  # Python, Y U no have try_remove?
          return np.int32(tmp)
  
      return fn.external_source(get_classes, batch=False)
  
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 18 for calling a global function with example usage: random_classes(background) and returns: fn, np