code: def _write_final_domain(
      domain_file: Path,
      new_forms: Dict,
      new_slots: Dict,
      out_file: Path,
  ) -> None:
      if domain_file.is_dir():
          for file in domain_file.iterdir():
              if not Domain.is_domain_file(file):
                  continue
              new_domain = _assemble_new_domain(
                  file, new_forms, new_slots
              )
              rasa.shared.utils.io.write_yaml(
                  new_domain, out_file / file.name, True
              )
      else:
          new_domain = _assemble_new_domain(
              domain_file, new_forms, new_slots
          )
          rasa.shared.utils.io.write_yaml(new_domain, out_file, True)
  
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 9 for calling a global function with example usage: _write_final_domain(domain_file, new_forms, new_slots, out_file) without return types