code: def safe_isinstance(obj, *instance_str):
      """Checks instance by comparing str(type(obj)) to one or more
      instance_str."""
      obj_str = str(type(obj))
      for i in instance_str:
          if i.endswith("'>"):
              if obj_str.endswith(i):
                  return True
          else:
              if obj_str[:-2].endswith(i):
                  return True
      return False
  
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 2 for calling a global function with example usage: safe_isinstance(obj) and returns: False, True, True