def METHOD_NAME(self, package_name: str) -> Optional[PackageData]:
    get_base_urls = self.get_base_urls_weak_method()
    if get_base_urls is None:
        return None
    base_urls = get_base_urls()
    if base_urls != self._last_base_urls:
        # We need to clear packages if urls changed.
        self._last_base_urls = base_urls
        self._cached_package_data.clear()
        self._cached_cloud.clear()
    try:
        return self._cached_package_data[package_name]
    except KeyError:
        pass
    for base_url in base_urls:
        if base_url.endswith("/"):
            base_url = base_url[:-1]
        data = self._get_json_from_cloud(f"{base_url}/pypi/{package_name}/json")
        if not data:
            continue  # go to the next url
        try:
            releases = data["releases"]
        except KeyError:
            continue  # go to the next url
        try:
            info = data["info"]
        except KeyError:
            continue  # go to the next url
        package_data = PackageData(package_name, info)
        if releases and isinstance(releases, dict):
            for release_number, release_info in releases.items():
                package_data.add_release(release_number, release_info)
        self._cached_package_data[package_name] = package_data
        return self._cached_package_data[package_name]
    # If there was no match, return.
    return None