def METHOD_NAME(
    obj: t.Any,
    db: SQLAlchemy,
    title: str,
    message: str,
    success: str = '',
    next: t.Optional[str] = None,  # noqa: A002  # pylint: disable=W0622
    cancel_url: t.Optional[str] = None,
    delete_text: t.Optional[str] = None,
    cancel_text: t.Optional[str] = None,
) -> Response:
    """Render a delete page for SQLAlchemy objects."""
    if not obj:
        abort(404)
    form = ConfirmDeleteForm()
    if request.method in ('POST', 'DELETE') and form.validate():
        if 'delete' in request.form or request.method == 'DELETE':
            db.session.delete(obj)
            db.session.commit()
            if success:
                flash(success, 'success')
            return render_redirect(next or url_for('index'), code=303)
        return render_redirect(cancel_url or next or url_for('index'), code=303)
    template = THEME_FILES[current_app.config['theme']]['delete.html.jinja2']
    return make_response(
        render_template(
            template,
            form=form,
            title=title,
            message=message,
            delete_text=delete_text,
            cancel_text=cancel_text,
        )
    )