code: def calculate_mean_depth_of_points_in_tree(
      tree, X, feature_costs=None
  ):
      """Calculate the mean depth of each point in the tree.
      This is the average depth of the path from the root to the point.
      """
      feature_costs = _validate_feature_costs(
          feature_costs, n_features=X.shape[1]
      )
  
      if isinstance(tree, CustomDecisionTreeClassifier):
          return _mean_depth_custom_tree(tree, X, feature_costs)
      elif hasattr(tree, "tree_"):
          return _mean_depth_sklearn_tree(tree.tree_, X, feature_costs)
      elif hasattr(tree, "estimator_"):
          return _mean_depth_sklearn_tree(
              tree.estimator_.tree_, X, feature_costs
          )
      else:
          return _mean_depth_coct_tree(tree, X, feature_costs)
  
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 3 for calling a global function with example usage: calculate_mean_depth_of_points_in_tree(tree, X, feature_costs) and returns: _mean_depth_custom_tree, _mean_depth_sklearn_tree, _mean_depth_sklearn_tree, _mean_depth_coct_tree