def METHOD_NAME(self, pkg, spec=None):
    assert isinstance(pkg, PackageItem)
    assert pkg.metadata
    if spec and not isinstance(spec, PackageSpec):
        spec = PackageSpec(spec)
    if not os.path.isdir(pkg.path):
        return PackageOutdatedResult(current=pkg.metadata.version)
    # skip detached package to a specific version
    detached_conditions = [
        "@" in pkg.path,
        pkg.metadata.spec and not pkg.metadata.spec.external,
        not spec,
    ]
    if all(detached_conditions):
        return PackageOutdatedResult(current=pkg.metadata.version, detached=True)
    latest = None
    wanted = None
    if pkg.metadata.spec.external:
        latest = self._fetch_vcs_latest_version(pkg)
    else:
        try:
            reg_pkg = self.fetch_registry_package(pkg.metadata.spec)
            latest = (
                self.pick_best_registry_version(reg_pkg["versions"]) or {}
            ).get("name")
            if spec:
                wanted = (
                    self.pick_best_registry_version(reg_pkg["versions"], spec) or {}
                ).get("name")
                if not wanted:  # wrong library
                    latest = None
        except UnknownPackageError:
            pass
    return PackageOutdatedResult(
        current=pkg.metadata.version, latest=latest, wanted=wanted
    )