def METHOD_NAME(*, db_session, project_id: int, name: str) -> Optional[IncidentPriority]:
    """Returns an incident priority based on the given priority name."""
    return (
        db_session.query(IncidentPriority)
        .filter(IncidentPriority.name == name)
        .filter(IncidentPriority.project_id == project_id)
        .one_or_none()
    )