def METHOD_NAME(
    result: pm.AnalysisResult,
    cve_categorisation: dso.cvss.CveCategorisation,
    rescoring_rules: typing.Iterable[dso.cvss.RescoringRule],
):
    worst_severity = dso.cvss.CVESeverity.NONE
    worst_rescored = dso.cvss.CVESeverity.NONE
    for component in result.components():
        for vulnerability in component.vulnerabilities():
            orig_sev = dso.cvss.CVESeverity.from_cve_score(vulnerability.cve_severity())
            worst_severity = max(worst_severity, orig_sev)
            if not vulnerability.cvss: # happens if only cvss-v2 is available
                continue
            rules = tuple(dso.cvss.matching_rescore_rules(
                rescoring_rules=rescoring_rules,
                categorisation=cve_categorisation,
                cvss=vulnerability.cvss,
            ))
            rescored = dso.cvss.rescore(
                rescoring_rules=rules,
                severity=orig_sev,
            )
            worst_rescored = max(worst_rescored, rescored)
    return worst_severity, worst_rescored