code: def _mean_depth_coct_tree(coct_tree, X, feature_costs):
      indicator = coct_tree.decision_path(X)[:, coct_tree.branch_nodes]
      feature_use_counts = indicator.sum(axis=0)
      n_branch_nodes = indicator.shape[1]
      node_idx_to_feature_cost = {
          i: feature_costs[coct_tree.feature_[i]]
          for i in range(n_branch_nodes)
      }
      cost = sum(
          [
              node_idx_to_feature_cost[i] * feature_use_counts[i]
              for i in range(n_branch_nodes)
          ]
      ) / len(X)
      return cost
  
file_path: imodels/imodels/util/tree.py
imports: from sklearn import datasets
  from sklearn.tree import DecisionTreeRegressor
  import numpy
  from sklearn.tree._tree import Tree
  from imodels.tree.custom_greedy_tree import CustomDecisionTreeClassifier
label_desc: Use image node_id 6 for calling a global function with example usage: _mean_depth_coct_tree(coct_tree, X, feature_costs) and returns: cost