def METHOD_NAME(image, labels):
    module = cellprofiler.modules.definegrid.DefineGrid()
    module.set_module_num(1)
    module.grid_image.value = GRID_NAME
    module.manual_image.value = INPUT_IMAGE_NAME
    module.display_image_name.value = INPUT_IMAGE_NAME
    module.object_name.value = OBJECTS_NAME
    module.save_image_name.value = OUTPUT_IMAGE_NAME
    image_set_list = cellprofiler_core.image.ImageSetList()
    image_set = image_set_list.get_image_set(0)
    image_set.add(INPUT_IMAGE_NAME, cellprofiler_core.image.Image(image))
    object_set = cellprofiler_core.object.ObjectSet()
    objects = cellprofiler_core.object.Objects()
    objects.segmented = labels
    object_set.add_objects(objects, OBJECTS_NAME)
    pipeline = cellprofiler_core.pipeline.Pipeline()
    def callback(caller, event):
        assert not isinstance(event, cellprofiler_core.pipeline.event.LoadException)
        assert not isinstance(event, cellprofiler_core.pipeline.event.RunException)
    pipeline.add_listener(callback)
    pipeline.add_module(module)
    measurements = cellprofiler_core.measurement.Measurements()
    workspace = cellprofiler_core.workspace.Workspace(
        pipeline, module, image_set, object_set, measurements, image_set_list
    )
    return workspace, module