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