def xrt_find_package_path(packages, name):
    """
    Get package path from a list of package from "ansible.builtin.find".

    Args:
        packages (list of dict): XRT packages list.
        name (str): Package name: 'xrt' or 'aws'.

    Returns:
        str: Package path.
    """
    filtered = tuple(
        package["path"]
        for package in packages
        if package["path"].rsplit(".", 1)[0].endswith("-" + name)
    )
    try:
        return filtered[0]
    except IndexError:
        raise ValueError(
            'No package found for "%s" in %s'
            % (name, ", ".join(package["path"] for package in packages))
        )