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