code: def apply_transforms(model, X):
      r"""Apply special functions to the original features.
  
      Parameters
      ----------
      model : alphapy.Model
          Model specifications indicating any transforms.
      X : pandas.DataFrame
          Combined train and test data, or just prediction data.
  
      Returns
      -------
      all_features : pandas.DataFrame
          All features, including transforms.
  
      Raises
      ------
      IndexError
          The number of transform rows must match the number of
          rows in ``X``.
  
      """
  
      # Extract model parameters
      transforms = model.specs["transforms"]
  
      # Log input parameters
  
      logger.info("Original Features : %s", X.columns)
      logger.info("Feature Count     : %d", X.shape[1])
  
      # Iterate through columns, dispatching and transforming each feature.
  
      logger.info("Applying transforms")
      all_features = X
  
      if transforms:
          for fname in transforms:
              # find feature series
              fcols = []
              for col in X.columns:
                  if col.split(LOFF)[0] == fname:
                      fcols.append(col)
              # get lag values
              lag_values = []
              for item in fcols:
                  _, _, _, lag = vparse(item)
                  lag_values.append(lag)
              # apply transform to the most recent value
              if lag_values:
                  f_latest = fcols[lag_values.index(min(lag_values))]
                  features = apply_transform(
                      f_latest, X, transforms[fname]
                  )
                  if features is not None:
                      if features.shape[0] == X.shape[0]:
                          all_features = pd.concat(
                              [all_features, features], axis=1
                          )
                      else:
                          raise IndexError(
                              "The number of transform rows [%d] must match X [%d]"
                              % (features.shape[0], X.shape[0])
                          )
                  else:
                      logger.info(
                          "Could not apply transform for feature %s",
                          fname,
                      )
              else:
                  logger.info(
                      "Feature %s is missing for transform", fname
                  )
      else:
          logger.info("No transforms Specified")
  
      logger.info("New Feature Count : %d", all_features.shape[1])
  
      # Return all transformed training and test features
      return all_features
  
imports: from alphapy.globals import BSEP, LOFF, NULLTEXT
  from alphapy.globals import PSEP, SSEP, USEP
  from alphapy.globals import Encoders
  from alphapy.globals import ModelType
  from alphapy.globals import Scalers
  from alphapy.variables import Variable
  from alphapy.variables import vparse
  import category_encoders
  from importlib import import_module
  import itertools
  import logging
  import math
  import numpy
  import os
  import pandas
  import re
  from scipy import sparse
  import scipy.stats
  from sklearn.cluster import MiniBatchKMeans
  from sklearn.decomposition import PCA
  from sklearn.feature_extraction.text import TfidfVectorizer
  from sklearn.feature_selection import chi2
  from sklearn.feature_selection import f_classif
  from sklearn.feature_selection import f_regression
  from sklearn.feature_selection import SelectFdr
  from sklearn.feature_selection import SelectFpr
  from sklearn.feature_selection import SelectFwe
  from sklearn.feature_selection import SelectKBest
  from sklearn.feature_selection import SelectPercentile
  from sklearn.feature_selection import VarianceThreshold
  from sklearn.impute import SimpleImputer
  from sklearn.manifold import Isomap
  from sklearn.manifold import TSNE
  from sklearn.preprocessing import MinMaxScaler
  from sklearn.preprocessing import PolynomialFeatures
  from sklearn.preprocessing import StandardScaler
  import sys
label_desc: Use image node_id 2 for calling a global function with example usage: apply_transforms(model, X) and returns: all_features