def METHOD_NAME(
    db: orm.Session, tool_id: int, version_id: int
) -> models.DatabaseVersion | None:
    return db.execute(
        sa.select(models.DatabaseVersion)
        .where(models.DatabaseVersion.id == version_id)
        .where(models.DatabaseVersion.tool_id == tool_id)
    ).scalar_one_or_none()