code: def _migrate_form_slots(
      domain: Dict[Text, Any]
  ) -> Tuple[Dict[Any, Dict[str, Any]], Optional[Any]]:
      updated_slots = domain.get(KEY_SLOTS, {})
      forms = domain.get(KEY_FORMS, {})
  
      new_forms = {}
  
      for form_name, form_data in forms.items():
          ignored_intents = form_data.pop(IGNORED_INTENTS, [])
          if REQUIRED_SLOTS_KEY in form_data:
              form_data = form_data.get(REQUIRED_SLOTS_KEY, {})
  
          required_slots = []
  
          for slot_name, mappings in form_data.items():
              condition = {ACTIVE_LOOP: form_name}
              slot_properties = updated_slots.get(slot_name, {})
              existing_mappings = slot_properties.get("mappings", [])
              updated_mappings = _get_updated_or_new_mappings(
                  existing_mappings, mappings, condition, slot_name
              )
              slot_properties.update({"mappings": updated_mappings})
              updated_slots[slot_name] = slot_properties
  
              required_slots.append(slot_name)
  
          new_forms[form_name] = {REQUIRED_SLOTS_KEY: required_slots}
  
          if ignored_intents:
              new_forms[form_name][IGNORED_INTENTS] = ignored_intents
  
      return new_forms, updated_slots
  
imports: import copy
  import shutil
  from pathlib import Path
  from typing import List, Dict, Text, Any, Tuple, Optional, Union
  from ruamel.yaml.scalarstring import DoubleQuotedScalarString
  import rasa.shared.utils.io
  import rasa.shared.utils.cli
  from rasa.shared.constants import REQUIRED_SLOTS_KEY, IGNORED_INTENTS
  from rasa.shared.core.constants import ACTIVE_LOOP, REQUESTED_SLOT, SlotMappingType, MAPPING_TYPE, SLOT_MAPPINGS
  from rasa.shared.constants import LATEST_TRAINING_DATA_FORMAT_VERSION
  from rasa.shared.core.domain import KEY_ENTITIES, KEY_SLOTS, KEY_FORMS, Domain
  from rasa.shared.exceptions import RasaException
  from rasa.shared.utils.validation import KEY_TRAINING_DATA_FORMAT_VERSION
label_desc: Use image node_id 4 for calling a global function with example usage: _migrate_form_slots(domain) and returns: new_forms,  updated_slots