code: def _get_updated_or_new_mappings(
      existing_mappings: List[Dict[Text, Any]],
      new_mappings: List[Dict[Text, Any]],
      condition: Dict[Text, Text],
      slot_name: Text,
  ) -> List[Dict[Text, Any]]:
      updated_mappings = []
  
      for existing_mapping in existing_mappings:
          mapping_copy = copy.deepcopy(existing_mapping)
  
          conditions = existing_mapping.pop("conditions", [])
          if existing_mapping in new_mappings:
              new_mappings.remove(existing_mapping)
              conditions.append(
                  _get_updated_mapping_condition(
                      condition, existing_mapping, slot_name
                  )
              )
              existing_mapping.update({"conditions": conditions})
              updated_mappings.append(existing_mapping)
          else:
              updated_mappings.append(mapping_copy)
  
      for mapping in new_mappings:
          mapping.update(
              {
                  "conditions": [
                      _get_updated_mapping_condition(
                          condition, mapping, slot_name
                      )
                  ]
              }
          )
          updated_mappings.append(mapping)
  
      return updated_mappings
  
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 3 for calling a global function with example usage: _get_updated_or_new_mappings(existing_mappings, new_mappings, condition, slot_name) and returns: updated_mappings