code: def remove_cat_names(X_cats, onehot_dict, onehot_missing_dict=None):
      """removes the leading category names in the onehotencoded columns.
      Turning e.g 'Sex_male' into 'male', etc"""
      X_cats = X_cats.copy()
      for cat, cols in onehot_dict.items():
          if len(cols) > 1:
              mapping = {
                  c: (
                      c[len(cat) + 1 :]
                      if c.startswith(cat + "_")
                      else c
                  )
                  for c in cols
              }
              if onehot_missing_dict:
                  mapping.update(
                      {
                          onehot_missing_dict[cat]: onehot_missing_dict[
                              cat
                          ]
                      }
                  )
              X_cats[cat] = X_cats[cat].map(mapping, na_action="ignore")
      return X_cats
  
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 12 for calling a global function with example usage: remove_cat_names(X_cats, onehot_dict, onehot_missing_dict) and returns: X_cats