def METHOD_NAME(
    vulnerability: AdvisoryVulnerability,
) -> SimpleAdvisoryVulnerability:
    if isinstance(vulnerability, dict):
        vulnerability_package: SimpleAdvisoryVulnerabilityPackage = vulnerability["package"]
        return {
            "package": {
                "ecosystem": vulnerability_package["ecosystem"],
                "name": vulnerability_package["name"],
            },
            "patched_versions": vulnerability["patched_versions"],
            "vulnerable_functions": vulnerability["vulnerable_functions"],
            "vulnerable_version_range": vulnerability["vulnerable_version_range"],
        }
    return {
        "package": {
            "ecosystem": vulnerability.package.ecosystem,
            "name": vulnerability.package.name,
        },
        "patched_versions": vulnerability.patched_versions,
        "vulnerable_functions": vulnerability.vulnerable_functions,
        "vulnerable_version_range": vulnerability.vulnerable_version_range,
    }