code: def make_workspace(image_set_count):
      image_set_list = cellprofiler_core.image.ImageSetList()
      for i in range(image_set_count):
          image_set = image_set_list.get_image_set(i)
      module = cellprofiler.modules.labelimages.LabelImages()
      pipeline = cellprofiler_core.pipeline.Pipeline()
  
      def callback(caller, event):
          assert not isinstance(
              event, cellprofiler_core.pipeline.event.RunException
          )
  
      pipeline.add_listener(callback)
      module.set_module_num(1)
      pipeline.add_module(module)
  
      workspace = cellprofiler_core.workspace.Workspace(
          pipeline,
          module,
          image_set_list.get_image_set(0),
          cellprofiler_core.object.ObjectSet(),
          cellprofiler_core.measurement.Measurements(),
          image_set_list,
      )
      return workspace, module
  
file_path: CellProfiler/tests/frontend/modules/test_labelimages.py
imports: import six.moves
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  from cellprofiler_core.constants.measurement import M_SITE, M_ROW, M_COLUMN, M_PLATE, M_WELL
  import cellprofiler.modules.labelimages
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.workspace
  import tests.frontend.modules
label_desc: Use image node_id 2 for calling a global function with example usage: make_workspace(image_set_count) and returns: workspace,  module