async def METHOD_NAME(
    address: Address,
    binary_name: str,
    extra_search_paths: Iterable[str],
    fingerprint_pattern: str | None,
    fingerprint_args: tuple[str, ...] | None,
    fingerprint_dependencies: tuple[str, ...] | None,
) -> BinaryPath:
    search_paths = tuple(extra_search_paths) + SEARCH_PATHS
    binaries = await Get(
        BinaryPaths,
        BinaryPathRequest(
            binary_name=binary_name,
            search_path=search_paths,
        ),
    )
    fingerprint_args = fingerprint_args or ()
    deps = await Get(
        ResolvedExecutionDependencies,
        ResolveExecutionDependenciesRequest(address, (), fingerprint_dependencies),
    )
    rds = deps.runnable_dependencies
    env: dict[str, str] = {}
    append_only_caches: Mapping[str, str] = {}
    immutable_input_digests: Mapping[str, Digest] = {}
    if rds:
        env = {"PATH": rds.path_component}
        env.update(**(rds.extra_env or {}))
        append_only_caches = rds.append_only_caches
        immutable_input_digests = rds.immutable_input_digests
    tests: tuple[FallibleProcessResult, ...] = await MultiGet(
        Get(
            FallibleProcessResult,
            Process(
                description=f"Testing candidate for `{binary_name}` at `{path.path}`",
                argv=(path.path,) + fingerprint_args,
                input_digest=deps.digest,
                env=env,
                append_only_caches=append_only_caches,
                immutable_input_digests=immutable_input_digests,
            ),
        )
        for path in binaries.paths
    )
    for test, binary in zip(tests, binaries.paths):
        if test.exit_code != 0:
            continue
        if fingerprint_pattern:
            fingerprint = test.stdout.decode().strip()
            match = re.match(fingerprint_pattern, fingerprint)
            if not match:
                continue
        return binary
    raise ValueError(
        f"Could not find a binary with name `{binary_name}`"
        + (
            ""
            if not fingerprint_pattern
            else f" with output matching `{fingerprint_pattern}` when run with arguments `{' '.join(fingerprint_args or ())}`"
        )
        + f". The following paths were searched: {', '.join(search_paths)}."
    )