async def METHOD_NAME(binary_names: Iterable[str], search_paths: Iterable[str]) -> str:
    """Find the path to an executable by checking whether the executable supports a version
    option."""
    for name in binary_names:
        binary_paths = await Get(  # noqa: PNT30: requires triage
            BinaryPaths,
            BinaryPathRequest(
                binary_name=name,
                search_path=search_paths,
                test=BinaryPathTest(args=["-v"]),
            ),
        )
        if not binary_paths or not binary_paths.first_path:
            continue
        return binary_paths.first_path.path
    raise BinaryNotFoundError(f"Could not find any of '{binary_names}' in any of {search_paths}.")