from typing import List
from typing import Optional


def _find_priority(labels: List[str]) -> Optional[str]:
    """Find a priority value given label names."""
    prio = {label: label for label in labels if label.startswith("priority")}
    return (
        prio.get("priority_critical")
        or prio.get("priority_major")
        or prio.get("priority_medium")
        or prio.get("priority_low")
    )