code: def get_xgboost_path_summary_df(xgboost_path_df, output="margin"):
      """turn output of get_xgboost_path_df output into a formatted dataframe
  
      Args:
          xgboost_path_df (pd.DataFrame): output of get_xgboost_path_df
          prediction (str, {'logodds', 'margin'}): Type of output prediction.
              Defaults to "margin".
  
      Returns:
          pd.DataFrame: dataframe with nodes and split conditions
      """
      xgboost_path_summary_df = pd.DataFrame(
          columns=["node", "split_condition"]
      )
  
      for row in xgboost_path_df.itertuples():
          if row.feature == "_PREDICTION":
              xgboost_path_summary_df = append_dict_to_df(
                  xgboost_path_summary_df,
                  dict(
                      node=row.node,
                      split_condition=f"prediction ({output}) = {row.value}",
                  ),
              )
          elif row.value < row.cutoff:
              xgboost_path_summary_df = append_dict_to_df(
                  xgboost_path_summary_df,
                  dict(
                      node=row.node,
                      split_condition=f"{row.feature} = {row.value} < {row.cutoff}",
                  ),
              )
          else:
              xgboost_path_summary_df = append_dict_to_df(
                  xgboost_path_summary_df,
                  dict(
                      node=row.node,
                      split_condition=f"{row.feature} = {row.value} >= {row.cutoff}",
                  ),
              )
      return xgboost_path_summary_df
  
imports: from functools import partial
  import re
  from collections import Counter
  from typing import List, Union
  import warnings
  import numpy
  import pandas
  from pandas.api.types import is_numeric_dtype, is_categorical_dtype
  from dtreeviz.trees import ShadowDecTree
  from sklearn.metrics import make_scorer
  from sklearn.base import clone
  from sklearn.pipeline import Pipeline
  from sklearn.model_selection import KFold, StratifiedKFold
  from joblib import Parallel, delayed
label_desc: Use image node_id 31 for calling a global function with example usage: get_xgboost_path_summary_df(xgboost_path_df, output) and returns: xgboost_path_summary_df