code: def upgrade_settings(
      self, setting_values, variable_revision_number, module_name
  ):
      if variable_revision_number == 1:
          # We added the ability to process multiple objects in v2, but
          # the settings for v1 miraculously map to v2
          variable_revision_number = 2
  
      if variable_revision_number == 2:
          # Permits choice of binary image or objects to measure from
          count = len(setting_values) / 3
  
          new_setting_values = [str(count)]
  
          for i in range(0, count):
              new_setting_values += [
                  "Objects",
                  setting_values[(i * 3)],
                  setting_values[(i * 3) + 1],
                  setting_values[(i * 3) + 2],
                  "None",
              ]
  
          setting_values = new_setting_values
  
          variable_revision_number = 3
  
      if variable_revision_number == 3:
          n_objects = int(setting_values[0])
  
          operand_choices = setting_values[1::5][:n_objects]
          operand_objects = setting_values[2::5][:n_objects]
          binary_name = setting_values[5::5][:n_objects]
  
          object_settings = sum(
              [
                  list(settings)
                  for settings in zip(
                      operand_choices, operand_objects, binary_name
                  )
              ],
              [],
          )
  
          setting_values = [setting_values[0]] + object_settings
  
          variable_revision_number = 4
      if variable_revision_number == 4:
          num_sets = setting_values[0]
          setting_values = setting_values[1:]
          images_set = set()
          objects_set = set()
          conditions, names1, names2 = [
              (setting_values[i::3]) for i in range(3)
          ]
          for condition, name1, name2 in zip(
              conditions, names1, names2
          ):
              if condition == O_BINARY_IMAGE:
                  images_set.add(name2)
              elif condition == O_OBJECTS:
                  objects_set.add(name1)
          if "None" in images_set:
              images_set.remove("None")
          if "None" in objects_set:
              objects_set.remove("None")
          if len(images_set) > 0 and len(objects_set) > 0:
              mode = O_BOTH
          elif len(images_set) == 0:
              mode = O_OBJECTS
          else:
              mode = O_BINARY_IMAGE
          images_string = ", ".join(map(str, images_set))
          objects_string = ", ".join(map(str, objects_set))
          setting_values = [mode, images_string, objects_string]
          variable_revision_number = 5
      return setting_values, variable_revision_number
  
imports: import numpy
  import skimage.measure
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
  from cellprofiler_core.module import Module
  from cellprofiler_core.setting import Divider, ValidationError
  from cellprofiler_core.setting.choice import Choice
  from cellprofiler_core.setting.subscriber import ImageListSubscriber, LabelListSubscriber
label_desc: Use image node_id 16 for calling the MeasureImageAreaOccupied obj's underlying member method code with example usage: obj.upgrade_settings(setting_values, variable_revision_number, module_name) and returns: setting_values,  variable_revision_number