def METHOD_NAME(*, db_session, case_severity_in: CaseSeverityCreate) -> CaseSeverity:
    """Creates a case severity."""
    project = project_service.get_by_name_or_raise(
        db_session=db_session, project_in=case_severity_in.project
    )
    case_severity = CaseSeverity(
        **case_severity_in.dict(exclude={"project", "color"}), project=project
    )
    if case_severity_in.color:
        case_severity.color = case_severity_in.color.as_hex()
    db_session.add(case_severity)
    db_session.commit()
    return case_severity