def METHOD_NAME(
    request,
    salt_factories,
    host_docker_network_ip_address,
    state_tree,
    pillar_tree,
):
    master_id = random_string("master-compat-", uppercase=False)
    root_dir = salt_factories.get_root_dir_for_daemon(master_id)
    conf_dir = root_dir / "conf"
    conf_dir.mkdir(exist_ok=True)
    config_defaults = {
        "root_dir": str(root_dir),
        "transport": request.config.getoption("--transport"),
    }
    config_overrides = {
        "interface": host_docker_network_ip_address,
        "log_level_logfile": "quiet",
        # We also want to scrutinize the key acceptance
        "open_mode": False,
    }
    # We need to copy the extension modules into the new master root_dir or
    # it will be prefixed by it
    extension_modules_path = str(root_dir / "extension_modules")
    if not os.path.exists(extension_modules_path):
        shutil.copytree(
            os.path.join(RUNTIME_VARS.FILES, "extension_modules"),
            extension_modules_path,
        )
    config_overrides.update(
        {
            "extension_modules": extension_modules_path,
            "file_roots": {"base": [str(state_tree)]},
            "pillar_roots": {"base": [str(pillar_tree)]},
        }
    )
    factory = salt_factories.salt_master_daemon(
        master_id,
        defaults=config_defaults,
        overrides=config_overrides,
    )
    with factory.started():
        yield factory