code: def export_stacked_ensemble(id):
      path = functions.get_path_from_query_string(request)
  
      with functions.DBContextManager(path) as session:
          stacked_ensemble = (
              session.query(models.StackedEnsemble)
              .filter_by(id=id)
              .first()
          )
          if stacked_ensemble is None:
              raise exceptions.UserError(
                  "Stacked ensemble {} not found".format(id), 404
              )
  
          extraction = session.query(models.Extraction).first()
  
          if request.method == "POST":
              req_body = request.get_json()
              if req_body["type"] == "package":
                  stacked_ensemble.export_as_package(
                      os.path.join(path, req_body["name"]),
                      extraction.meta_feature_generation["source"],
                  )
              elif req_body["type"] == "file":
                  if not req_body["name"].endswith(".py"):
                      req_body["name"] += ".py"
                  stacked_ensemble.export_as_file(
                      os.path.join(path, req_body["name"]),
                      extraction.meta_feature_generation["source"],
                  )
              return jsonify(
                  message="Stacked ensemble successfully "
                  "exported as {} in {}".format(req_body["name"], path)
              )
  
imports: from __future__ import absolute_import, print_function, division, unicode_literals
  import os
  from flask import request, jsonify, send_from_directory, g
  from redis import Redis
  from rq import Connection
  from sqlalchemy import create_engine
  from sklearn.model_selection import ParameterGrid
  from sklearn.model_selection import ParameterSampler
  from xcessiv import app, functions, exceptions, models, rqtasks
  from xcessiv.presets import learnersetting, metricsetting, cvsetting
  import six
label_desc: Use image node_id 26 for calling a global function with example usage: export_stacked_ensemble(id) and returns: jsonify