code: def create_12_mon_features_union(joined_df, **kwargs):
      chronometer = Chronometer.makeStarted()
      tables = {"joined_df": joined_df}
      josh_mody_n_str = (
          "timestamp_year * 12 + timestamp_month - 24000.0"
      )
      query = (
          "SELECT loan_id, "
          + josh_mody_n_str
          + " as josh_mody_n, max(delinquency_12) as max_d12,"
          + " min(upb_12) as min_upb_12"
          + " FROM main.joined_df as joined_df GROUP BY loan_id, "
          + josh_mody_n_str
      )
      mastertemp = pyblazing.run_query(query, tables)
  
      all_temps = []
      all_tokens = []
      tables = {"joined_df": mastertemp.columns}
      n_months = 12
  
      for y in range(1, n_months + 1):
          josh_mody_n_str = "floor((josh_mody_n - " + str(y) + ")/12.0)"
          query = (
              "SELECT loan_id, "
              + josh_mody_n_str
              + " as josh_mody_n, max(max_d12) > 3 as max_d12_gt3,"
              + " min(min_upb_12) = 0 as min_upb_12_eq0,"
              + " min(min_upb_12) as upb_12"
              + " FROM main.joined_df as joined_df GROUP BY loan_id, "
              + josh_mody_n_str
          )
  
          metaToken = pyblazing.run_query_get_token(query, tables)
          all_tokens.append(metaToken)
  
      for metaToken in all_tokens:
          temp = pyblazing.run_query_get_results(metaToken)
          all_temps.append(temp)
  
      y = 1
      tables2 = {"temp1": all_temps[0].columns}
      union_query = (
          """(SELECT loan_id, max_d12_gt3 + min_upb_12_eq0 as delinquency_12,
           upb_12, floor(((josh_mody_n * 12) + """
          + str(24000 + (y - 1))
          + ")/12) as timestamp_year, josh_mody_n * 0 + "
          + str(y)
          + " as timestamp_month from main.temp"
          + str(y)
          + ")"
      )
      for y in range(2, n_months + 1):
          tables2["temp" + str(y)] = all_temps[y - 1].columns
          query = (
              """ UNION ALL (SELECT loan_id, max_d12_gt3 + min_upb_12_eq0 as
              delinquency_12, upb_12, floor(((josh_mody_n * 12) + """
              + str(24000 + (y - 1))
              + ")/12) as timestamp_year, josh_mody_n * 0 + "
              + str(y)
              + " as timestamp_month from main.temp"
              + str(y)
              + ")"
          )
          union_query = union_query + query
  
      results = pyblazing.run_query(union_query, tables2)
      Chronometer.show(chronometer, "Create 12 month features once")
      return results
  
imports: import time
  from collections import OrderedDict
  import numpy
  import pandas
  import pyblazing
  from pyblazing import DriverType, FileSystemType, SchemaFrom, get_dtype_values
  from sklearn.model_selection import train_test_split
  import xgboost
  from Configuration import Settings
  from DemoTest.chronometer import Chronometer
  from Utils import Execution
label_desc: Use image node_id 16 for calling a global function with example usage: create_12_mon_features_union(joined_df) and returns: results