code: def export_stacked_ensemble_as_base_learner_origin(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":
              source = stacked_ensemble.export_as_code(
                  extraction.meta_feature_generation["source"]
              )
  
              new_base_learner_origin = models.BaseLearnerOrigin(
                  source=source,
                  name="Xcessiv Ensemble",
                  meta_feature_generator=stacked_ensemble.base_learner_origin.meta_feature_generator,
              )
  
              session.add(new_base_learner_origin)
              session.commit()
              return jsonify(new_base_learner_origin.serialize)
  
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 27 for calling a global function with example usage: export_stacked_ensemble_as_base_learner_origin(id) and returns: jsonify