code: def make_workspace(image_measurements, object_measurements):
      """Make a workspace with a FlagImage module and the given measurements
  
      image_measurements - a sequence of single image measurements. Use
                              image_measurement_name(i) to get the name of
                              the i th measurement
      object_measurements - a seequence of sequences of object measurements.
                              These are stored under object, OBJECT_NAME with
                              measurement name object_measurement_name(i) for
                              the i th measurement.
  
      returns module, workspace
      """
      module = cellprofiler.modules.flagimage.FlagImage()
      measurements = cellprofiler_core.measurement.Measurements()
      for i in range(len(image_measurements)):
          measurements.add_image_measurement(
              image_measurement_name(i), image_measurements[i]
          )
      for i in range(len(object_measurements)):
          measurements.add_measurement(
              OBJECT_NAME,
              object_measurement_name(i),
              numpy.array(object_measurements[i]),
          )
      flag = module.flags[0]
      assert isinstance(flag, cellprofiler_core.setting.SettingsGroup)
      flag.category.value = MEASUREMENT_CATEGORY
      flag.feature_name.value = MEASUREMENT_FEATURE
      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)
      image_set_list = cellprofiler_core.image.ImageSetList()
      image_set = image_set_list.get_image_set(0)
      workspace = cellprofiler_core.workspace.Workspace(
          pipeline,
          module,
          image_set,
          cellprofiler_core.object.ObjectSet(),
          measurements,
          image_set_list,
      )
      return module, workspace
  
imports: import contextlib
  import os
  import tempfile
  import numpy
  import pytest
  import six.moves
  from cellprofiler_core.constants.measurement import COLTYPE_INTEGER
  from cellprofiler_core.constants.workspace import DISPOSITION_CONTINUE, DISPOSITION_SKIP
  import tests.frontend.modules
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler.modules.flagimage
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.preferences
  import cellprofiler_core.setting
  import cellprofiler_core.workspace
  from .None import test_filterobjects
label_desc: Use image node_id 6 for calling a global function with example usage: make_workspace(image_measurements, object_measurements) and returns: module,  workspace