code: def make_workspace(
      labels, contrast_choice, measurement1=None, measurement2=None
  ):
      object_set = cellprofiler_core.object.ObjectSet()
      objects = cellprofiler_core.object.Objects()
      objects.segmented = labels
      object_set.add_objects(objects, OBJECTS_NAME)
  
      measurements = cellprofiler_core.measurement.Measurements()
      module = cellprofiler.modules.classifyobjects.ClassifyObjects()
      m_names = []
      if measurement1 is not None:
          measurements.add_measurement(
              OBJECTS_NAME, MEASUREMENT_NAME_1, measurement1
          )
          m_names.append(MEASUREMENT_NAME_1)
      if measurement2 is not None:
          measurements.add_measurement(
              OBJECTS_NAME, MEASUREMENT_NAME_2, measurement2
          )
          module.add_single_measurement()
          m_names.append(MEASUREMENT_NAME_2)
      image_set_list = cellprofiler_core.image.ImageSetList()
      image_set = image_set_list.get_image_set(0)
  
      module.contrast_choice.value = contrast_choice
      if (
          module.contrast_choice
          == cellprofiler.modules.classifyobjects.BY_SINGLE_MEASUREMENT
      ):
          for i, m in enumerate(m_names):
              group = module.single_measurements[i]
              group.object_name.value = OBJECTS_NAME
              group.measurement.value = m
              group.image_name.value = IMAGE_NAME
      else:
          module.object_name.value = OBJECTS_NAME
          module.image_name.value = IMAGE_NAME
          module.first_measurement.value = MEASUREMENT_NAME_1
          module.second_measurement.value = MEASUREMENT_NAME_2
      module.set_module_num(1)
      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,
          object_set,
          measurements,
          image_set_list,
      )
      return workspace, module
  
imports: import contextlib
  import os
  import pickle
  import tempfile
  import numpy
  import pytest
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT, COLTYPE_INTEGER
  import cellprofiler.modules.classifyobjects
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.setting
  import cellprofiler_core.workspace
label_desc: Use image node_id 1 for calling a global function with example usage: make_workspace(labels, contrast_choice, measurement1, measurement2) and returns: workspace,  module