code: def get_tree_info(
      decision_tree, feature_names=None, **export_graphviz_kwargs
  ):
      # type: (...) -> TreeInfo
      """
      Convert DecisionTreeClassifier or DecisionTreeRegressor
      to an inspectable object.
      """
      return TreeInfo(
          criterion=decision_tree.criterion,
          tree=_get_root_node_info(decision_tree, feature_names),
          graphviz=tree2dot(
              decision_tree,
              feature_names=feature_names,
              **export_graphviz_kwargs,
          ),
          is_classification=isinstance(decision_tree, ClassifierMixin),
      )
  
file_path: eli5/eli5/sklearn/treeinspect.py
imports: from __future__ import absolute_import, division
  from sklearn.base import ClassifierMixin
  from sklearn.tree import _tree, export_graphviz
  from eli5.base import TreeInfo, NodeInfo
label_desc: Use image node_id 1 for calling a global function with example usage: get_tree_info(decision_tree, feature_names) and returns: TreeInfo