code: def viz_leaf_target(
      tree_model,
      X_train: (pd.DataFrame, np.ndarray) = None,
      y_train: (pd.DataFrame, np.ndarray) = None,
      feature_names: List[str] = None,
      target_name: str = None,
      tree_index: int = None,  # required in case of tree ensemble,
      show_leaf_labels: bool = True,
      colors: dict = None,
      markersize: int = 50,
      label_fontsize: int = 10,
      fontname: str = "Arial",
      precision: int = 1,
      grid: bool = False,
      prediction_line_width: int = 2,
      figsize: tuple = None,
      ax=None,
  ):
      """Visualize leaf target distribution for regression decision trees.
  
      We can call this function in two ways :
      1. by using shadow tree
          ex. viz_leaf_target(shadow_dtree)
          - we need to initialize shadow_tree before this call
              - ex. shadow_dtree = ShadowSKDTree(tree_model, dataset[features], dataset[target], features, target)
          - the main advantage is that we can use the shadow_tree for other visualisations methods as well
      2. by using sklearn, xgboost tree
          ex. viz_leaf_target(tree_model, dataset[features], dataset[target], features, target)
          - maintain backward compatibility
  
  
      :param tree_model: tree.DecisionTreeRegressor, xgboost.core.Booster,
                  dtreeviz.models.sklearn_decision_trees.ShadowSKDTree,
                  dtreeviz.models.xgb_decision_trees.ShadowXGBDTree
          The tree model or dtreeviz shadow tree model to interpret
      :param X_train: pd.DataFrame, np.ndarray
          The dataset based on which we want to make this visualisation.
      :param y_train: pd.Series, np.ndarray
          Target variable values
      :param feature_names: List[str], optional
          The list of feature variable's name
      :param target_name: str, optional
          The name of target variable
      :param tree_index: int, optional
          Required in case of tree ensemble. Specify the tree index to interpret.
      :param show_leaf_labels: bool
          True if the plot should contains the leaf labels on x ax, False otherwise.
      :param markersize: int
          Marker size in points.
      :param precision: int
          When displaying floating-point numbers, how many digits to display after the decimal point. Default is 1.
      :param grid: bool
          True if we want to display the grid lines on the visualization
      :param prediction_line_width: int
          The width of prediction line.
      :param figsize: optional (width, height) in inches for the entire plot
      :param ax: optional matplotlib "axes" to draw into
      """
      warnings.warn(
          "viz_leaf_target() function is deprecated starting from version 2.0. \n "
          "For the same functionality, please use this code instead: \n m = dtreeviz.model(...) \n m.rtree_leaf_distributions()",
          DeprecationWarning,
          stacklevel=2,
      )
  
      shadow_tree = ShadowDecTree.get_shadow_tree(
          tree_model,
          X_train,
          y_train,
          feature_names,
          target_name,
          None,
          tree_index,
      )
      model = DTreeVizAPI(shadow_tree)
      model.rtree_leaf_distributions(
          show_leaf_labels,
          colors,
          markersize,
          label_fontsize,
          fontname,
          precision,
          grid,
          prediction_line_width,
          figsize,
          ax,
      )
  
imports: import warnings
  from numbers import Number
  from typing import Mapping, List
  import numpy
  import pandas
  from sklearn import tree
  from dtreeviz.models.shadow_decision_tree import ShadowDecTree
  from dtreeviz.utils import myround, DTreeVizRender
  from dtreeviz.trees import DTreeVizAPI
label_desc: Use image node_id 11 for calling a global function with example usage: viz_leaf_target(tree_model, X_train, y_train, feature_names, target_name, tree_index, show_leaf_labels, colors, markersize, label_fontsize, fontname, precision, grid, prediction_line_width, figsize, ax) without return types