code: def make_workspaces(images_and_masks):
      """Make a workspace for each image set provided
  
      images_and_masks - a collection of two-tuples: image+mask
  
      returns a list of workspaces + the module
      """
      image_set_list = cellprofiler_core.image.ImageSetList()
      workspaces = []
      module = (
          cellprofiler.modules.correctilluminationcalculate.CorrectIlluminationCalculate()
      )
      module.set_module_num(1)
      module.image_name.value = INPUT_IMAGE_NAME
      module.illumination_image_name.value = OUTPUT_IMAGE_NAME
      module.average_image_name.value = AVERAGE_IMAGE_NAME
      module.dilated_image_name.value = DILATED_IMAGE_NAME
      pipeline = cellprofiler_core.pipeline.Pipeline()
      pipeline.add_listener(error_callback)
      measurements = cellprofiler_core.measurement.Measurements()
  
      for i, (image, mask) in enumerate(images_and_masks):
          image_set = image_set_list.get_image_set(i)
          if mask is None:
              image = cellprofiler_core.image.Image(image)
          else:
              image = cellprofiler_core.image.Image(image, mask)
          image_set.add(INPUT_IMAGE_NAME, image)
          workspace = cellprofiler_core.workspace.Workspace(
              pipeline,
              module,
              image_set,
              cellprofiler_core.object.ObjectSet(),
              measurements,
              image_set_list,
          )
          workspaces.append(workspace)
      return workspaces, module
  
imports: import numpy
  import pytest
  from centrosome.bg_compensate import MODE_AUTO, MODE_BRIGHT, MODE_DARK, MODE_GRAY
  from six.moves import StringIO
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler.modules.correctilluminationcalculate
  import cellprofiler_core.modules.injectimage
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.setting
  import cellprofiler_core.workspace
  import tests.frontend.modules
label_desc: Use image node_id 2 for calling a global function with example usage: make_workspaces(images_and_masks) and returns: workspaces,  module