code: def _calc_impurity(self, y):
      if self.impurity_func == "gini":
          return self._gini(y)
      elif self.impurity_func in [
          "entropy",
          "information_gain_ratio",
          "cost_information_gain_ratio",
      ]:
          return self._entropy(y)
  
imports: from sklearn.tree._tree import Tree
  from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
  from sklearn.base import ClassifierMixin, RegressorMixin
  from sklearn import __version__
  from collections import namedtuple
  import pandas
  import numpy
  from collections import namedtuple
  from sklearn import __version__
  from sklearn.base import ClassifierMixin, RegressorMixin
  from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
  from sklearn.tree._tree import Tree
  import imodels.util.tree
label_desc: Use image node_id 5 for calling the CustomDecisionTreeClassifier obj's underlying member method code with example usage: obj._calc_impurity(y) and returns: self, self