code: def format_summary_df(summary_df, max_colwidth=20):
      """Formats the summary df for printing.
  
      Rounds numbers so they look good.
      Formats p-values to make them display the same way as the lm function in R.
      Replaces column names with index if they are too long.
  
      Parameters
      ----------
      summary_df : `pandas.DataFrame`
          The summary df with the following columns:
  
              "Pred_col" : `str`
                  Names for predictors.
              "Col_index" : `int`
                  Indices for predictors. Replaces ``Pred_col`` if predictor names are too long.
              "Estimate" : `float`
                  The estimation of coefficients.
              "Std. Err" : `float`, optional
                  The standard error for estimations.
              "t value" : `float`, optional
                  The t test statistics.
              "z value" : `float`, optional
                  The z test statistics. (for glm)
              "Pr(>|t|)" : `float`, optional
                  The t test p-values.
              "Pr(>|Z|)" : `float`, optional
                  The z test p-value. (for glm)
              "Pr(>)_boot" : `float`, optional
                  The bootstrap p-value. (for ridge)
              "sig. code" : `str`, optional
                  The significance code for p-values.
              "95%CI" : `list` [ `float` ], optional
                  The 95% confidence intervals.
  
      max_colwidth : `int`
          The maximum length for predictors to be shown in their original name.
          If the maximum length of predictors exceeds this parameter, all
          predictors name will be suppressed and only indices are shown.
  
      Returns
      -------
      formatted_summary_df : `pandas.DataFrame`
          Formatted summary dataframe.
      """
      summary_df_print = summary_df.copy()
      # Displays column index if the maximum length of column names is too long.
      if summary_df.shape[0] > 0:
          max_colname_length = max(
              [len(name) for name in summary_df["Pred_col"]]
          )
          summary_df_print["Pred_col"] = simplify_pred_cols(
              summary_df_print["Pred_col"]
          )
          if max_colname_length > max_colwidth:
              summary_df_print["Pred_col"] = [
                  col
                  if len(col) <= max_colwidth
                  else col[: int((max_colwidth - 3) // 2)]
                  + "..."
                  + col[-int((max_colwidth - 3) // 2) :]
                  for col in summary_df_print["Pred_col"]
              ]
          # Rounds columns
          if "Estimate" in summary_df_print.columns:
              summary_df_print["Estimate"] = round_numbers(
                  summary_df_print["Estimate"], 4
              )
          if "Std. Err" in summary_df_print.columns:
              summary_df_print["Std. Err"] = round_numbers(
                  summary_df_print["Std. Err"], 4
              )
          if "t value" in summary_df_print.columns:
              summary_df_print["t value"] = round_numbers(
                  summary_df_print["t value"], 4
              )
          if "z value" in summary_df_print.columns:
              summary_df_print["z value"] = round_numbers(
                  summary_df_print["z value"], 4
              )
          # Formats p-values
          if "Pr(>|t|)" in summary_df_print.columns:
              summary_df_print["Pr(>|t|)"] = [
                  "<2e-16"
                  if val < 2e-16
                  else "{:.2e}".format(val)
                  if val < 1e-3
                  else "{0:.3f}".format(val)
                  for val in summary_df_print["Pr(>|t|)"]
              ]
          if "Pr(>|Z|)" in summary_df_print.columns:
              summary_df_print["Pr(>|Z|)"] = [
                  "<2e-16"
                  if val < 2e-16
                  else "{:.2e}".format(val)
                  if val < 1e-3
                  else "{0:.3f}".format(val)
                  for val in summary_df_print["Pr(>|Z|)"]
              ]
          if "Pr(>)_boot" in summary_df_print.columns:
              summary_df_print["Pr(>)_boot"] = [
                  "<2e-16"
                  if val < 2e-16
                  else "{:.2e}".format(val)
                  if val < 1e-3
                  else "{0:.3f}".format(val)
                  for val in summary_df_print["Pr(>)_boot"]
              ]
          if "Pr(>)_split" in summary_df_print.columns:
              summary_df_print["Pr(>)_split"] = [
                  "<2e-16"
                  if val < 2e-16
                  else "{:.2e}".format(val)
                  if val < 1e-3
                  else "{0:.3f}".format(val)
                  for val in summary_df_print["Pr(>)_split"]
              ]
          # Formats confidence intervals
          if "95%CI" in summary_df_print.columns:
              lbs = round_numbers(
                  [ci[0] for ci in summary_df_print["95%CI"]], 4
              )
              ubs = round_numbers(
                  [ci[1] for ci in summary_df_print["95%CI"]], 4
              )
              summary_df_print["95%CI"] = list(zip(lbs, ubs))
          # Formats feature importance for tree
          if "Feature importance" in summary_df_print.columns:
              summary_df_print["Feature importance"] = round_numbers(
                  summary_df_print["Feature importance"], 4
              )
      return summary_df_print
  
imports: import numpy
  import pandas
  import statsmodels
  import statsmodels.api
  from scipy.stats import f
  from scipy.stats import norm
  from scipy.stats import t
  from sklearn.base import clone
  from sklearn.linear_model import Ridge
  from sklearn.model_selection import train_test_split
  from greykite.algo.common.col_name_utils import INTERCEPT
  from greykite.algo.common.col_name_utils import simplify_pred_cols
label_desc: Use image node_id 23 for calling a global function with example usage: format_summary_df(summary_df, max_colwidth) and returns: summary_df_print