code: def main_pipeline(model):
      r"""AlphaPy Main Pipeline
  
      Parameters
      ----------
      model : alphapy.Model
          The model specifications for the pipeline.
  
      Returns
      -------
      model : alphapy.Model
          The final model.
  
      """
  
      # Extract any model specifications
      predict_mode = model.specs["predict_mode"]
  
      # Prediction Only or Calibration
  
      if predict_mode:
          model = prediction_pipeline(model)
      else:
          model = training_pipeline(model)
  
      # Return the completed model
      return model
  
imports: import warnings
  from alphapy.data import get_data
  from alphapy.data import sample_data
  from alphapy.data import shuffle_data
  from alphapy.estimators import get_estimators
  from alphapy.estimators import scorers
  from alphapy.features import apply_transforms
  from alphapy.features import create_crosstabs
  from alphapy.features import create_features
  from alphapy.features import create_interactions
  from alphapy.features import drop_features
  from alphapy.features import remove_lv_features
  from alphapy.features import save_features
  from alphapy.features import select_features
  from alphapy.frame import write_frame
  from alphapy.globals import CSEP, PSEP, SSEP, USEP
  from alphapy.globals import ModelType
  from alphapy.globals import Partition, datasets
  from alphapy.globals import WILDCARD
  from alphapy.model import first_fit
  from alphapy.model import generate_metrics
  from alphapy.model import get_model_config
  from alphapy.model import load_feature_map
  from alphapy.model import load_predictor
  from alphapy.model import make_predictions
  from alphapy.model import Model
  from alphapy.model import predict_best
  from alphapy.model import predict_blend
  from alphapy.model import save_model
  from alphapy.model import save_predictions
  from alphapy.optimize import hyper_grid_search
  from alphapy.optimize import rfecv_search
  from alphapy.plots import generate_plots
  from alphapy.utilities import get_datestamp
  import argparse
  from datetime import datetime
  import logging
  import numpy
  import os
  import pandas
  from sklearn.model_selection import train_test_split
  import sys
label_desc: Use image node_id 3 for calling a global function with example usage: main_pipeline(model) and returns: model