code: def test_migrate_domain_raises_when_backup_location_exists(
      tmp_path: Path, migrate_file_only: bool
  ):
      domain_dir = tmp_path / "domain"
      domain_file_name = "domain.yml"
      domain_dir.mkdir()
      prepare_domain_path(
          domain_dir,
          """
          version: "2.0"
          intents: []
          """,
          domain_file_name,
      )
  
      if not migrate_file_only:
          domain_path = domain_dir
          backup_location = tmp_path / migrate.ORIGINAL_DOMAIN
          backup_location.mkdir()
      else:
          domain_path = domain_dir / domain_file_name
          backup_location = domain_dir / (
              migrate.ORIGINAL_DOMAIN + migrate.YML_SUFFIX
          )
          with open(backup_location, "w"):
              pass
  
      with pytest.raises(
          RasaException,
          match="The domain could not be migrated since .* exists.*",
      ):
          migrate.migrate_domain_format(domain_path, None)
  
imports: import itertools
  import shutil
  import re
  import textwrap
  from pathlib import Path
  from typing import Text, Any, Tuple, Callable
  from unittest.mock import patch, call
  import pytest
  import rasa.shared.utils.io
  from rasa.core import migrate
  from rasa.shared.core.domain import Domain
  from rasa.shared.exceptions import RasaException
  from rasa.shared.constants import LATEST_TRAINING_DATA_FORMAT_VERSION
label_desc: Use image node_id 22 for calling a global function with example usage: test_migrate_domain_raises_when_backup_location_exists(tmp_path, migrate_file_only) without return types