def METHOD_NAME(packages: Iterable[AnyPackageDataMinimal], allow_ignored: bool = False) -> AnyPackageDataMinimal | None:
    """Given a collection of packages, return a representative package.
    Same logic as packageset_to_best_by_repo, but assumes that all
    packages belong to a single repository. A bit more efficient.
    """
    sorted_packages = packageset_sort_by_version(packages)
    for package in sorted_packages:
        if _is_good_representative_package(package, allow_ignored):
            return package
    return sorted_packages[0] if sorted_packages else None