code: def model(
      model,
      X_train,
      y_train,
      tree_index: int = None,
      feature_names: List[str] = None,
      target_name: str = None,
      class_names: (List[str], Mapping[int, str]) = None,
  ) -> DTreeVizAPI:
      """
      Given a decision tree-based model from a supported decision-tree library, training data, and
      information about the data, create a model adaptor that provides a consistent interface for
      the overall dtreeviz lib to the various supported tree libraries. Call methods such as v.view(),
      v.explain_prediction_path(), v.rtree_feature_space3D() on the returned adaptor v.
  
      :param model: A tree-based model from a supportive decision tree library, such as sklearn, XGBoost, and TensorFlow.
      :param X_train: Features used to train model; 2D array-like object of shape (n_samples, n_features).
      :param y_train: Classifier or regressor target used to train model; 1D array-like object of shape (n_samples, 1).
      :param tree_index: Index (from 0) of tree if model is an ensemble of trees like a random forest.
      :param feature_names: Names of features in the same order of X_train.
      :param target_name: What is the (string) name of the target variable; e.g., for a house price regressor, this might be "price".
      :param class_names: For classifiers, what are the names associated with the labels?
      :return: a DTreeVizAPI object that provides the main API for dtreeviz (version 2.0.0+);
               e.g., call the view() method on the return object to display it in a notebook.
      """
      shadow_tree = ShadowDecTree.get_shadow_tree(
          model,
          X_train,
          y_train,
          feature_names,
          target_name,
          class_names,
          tree_index,
      )
      dtreeviz_model = DTreeVizAPI(shadow_tree)
      return dtreeviz_model
  
imports: import os
  import tempfile
  from typing import Mapping, List, Callable
  import matplotlib
  import matplotlib.patches
  import matplotlib.pyplot
  import numpy
  import pandas
  from colour import Color, rgb2hex
  from sklearn import tree
  from dtreeviz.colors import adjust_colors
  from dtreeviz.interpretation import explain_prediction_plain_english, explain_prediction_sklearn_default
  from dtreeviz.models.shadow_decision_tree import ShadowDecTree
  from dtreeviz.models.shadow_decision_tree import ShadowDecTreeNode
  from dtreeviz.utils import myround, DTreeVizRender, add_classifier_legend, _format_axes, _draw_wedge, _set_wedge_ticks, tessellate, is_numeric
label_desc: Use image node_id 16 for calling a global function with example usage: model(model, X_train, y_train, tree_index, feature_names, target_name, class_names) and returns: dtreeviz_model