code: def make_workspace(gridding, labels=None):
      module = (
          cellprofiler.modules.identifyobjectsingrid.IdentifyObjectsInGrid()
      )
      module.set_module_num(1)
      module.grid_name.value = GRID_NAME
      module.output_objects_name.value = OUTPUT_OBJECTS_NAME
      module.guiding_object_name.value = GUIDING_OBJECTS_NAME
      image_set_list = cellprofiler_core.image.ImageSetList()
      object_set = cellprofiler_core.object.ObjectSet()
      if labels is not None:
          my_objects = cellprofiler_core.object.Objects()
          my_objects.segmented = labels
          object_set.add_objects(my_objects, GUIDING_OBJECTS_NAME)
      pipeline = cellprofiler_core.pipeline.Pipeline()
  
      def callback(caller, event):
          assert not isinstance(
              event, cellprofiler_core.pipeline.event.RunException
          )
  
      pipeline.add_listener(callback)
      pipeline.add_module(module)
      workspace = cellprofiler_core.workspace.Workspace(
          pipeline,
          module,
          image_set_list.get_image_set(0),
          object_set,
          cellprofiler_core.measurement.Measurements(),
          image_set_list,
      )
      workspace.set_grid(GRID_NAME, gridding)
      return workspace, module
  
file_path: CellProfiler/tests/frontend/modules/test_identifyobjectsingrid.py
imports: import numpy
  import cellprofiler_core.utilities.grid
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler.modules.definegrid
  import cellprofiler.modules.identifyobjectsingrid
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.workspace
label_desc: Use image node_id 1 for calling a global function with example usage: make_workspace(gridding, labels) and returns: workspace,  module