code: def _class_leaf_viz(
      node: ShadowDecTreeNode,
      colors: List[str],
      filename: str,
      graph_colors,
      fontname,
      leaftype,
  ):
      graph_colors = adjust_colors(graph_colors)
  
      minsize = 0.15
      maxsize = 1.3
      slope = 0.02
      nsamples = node.nsamples()
      size = nsamples * slope + minsize
      size = min(size, maxsize)
  
      # we visually need n=1 and n=9 to appear different but diff between 300 and 400 is no big deal
      counts = node.class_counts()
      prediction = node.prediction_name()
  
      # when using another dataset than the training dataset, some leaves could have 0 samples.
      # Trying to make a pie chart will raise some deprecation
      if sum(counts) == 0:
          return
      if leaftype == "pie":
          _draw_piechart(
              counts,
              size=size,
              colors=colors,
              filename=filename,
              label=f"n={nsamples}\n{prediction}",
              graph_colors=graph_colors,
              fontname=fontname,
          )
      elif leaftype == "barh":
          _draw_barh_chart(
              counts,
              size=size,
              colors=colors,
              filename=filename,
              label=f"n={nsamples}\n{prediction}",
              graph_colors=graph_colors,
              fontname=fontname,
          )
      else:
          raise ValueError(f"Undefined leaftype = {leaftype}")
  
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 2 for calling a global function with example usage: _class_leaf_viz(node, colors, filename, graph_colors, fontname, leaftype) without return types