code: def tessellate(root, X_train, featidx):
      """
      Walk tree and return list of tuples containing a leaf node and bounding box list
      of(x1, y1, x2, y2) coordinates.
  
      Does not work for catvars!
      """
      bboxes = []  # filled in by walk()
      f1_values = X_train[:, featidx[0]]
      f2_values = X_train[:, featidx[1]]
  
      def walk(t, bbox, nsplits):
          if t is None:
              return
          # print(f"Node {t.id}: split {t.split()} featidx {t.feature()} bbox {bbox} {'   LEAF' if t.isleaf() else ''}")
          if t.isleaf() and nsplits > 0:
              # Only record bboxes where tree has split on one of the features of interest
              bboxes.append((t, bbox))
              return
          # shrink bbox for left, right and recurse
          s = t.split()
          if t.feature() == featidx[0]:
              walk(t.left, (bbox[0], bbox[1], s, bbox[3]), nsplits + 1)
              walk(t.right, (s, bbox[1], bbox[2], bbox[3]), nsplits + 1)
          elif t.feature() == featidx[1]:
              walk(t.left, (bbox[0], bbox[1], bbox[2], s), nsplits + 1)
              walk(t.right, (bbox[0], s, bbox[2], bbox[3]), nsplits + 1)
          else:
              walk(t.left, bbox, nsplits)
              walk(t.right, bbox, nsplits)
  
      # create bounding box in feature space (not zeroed)
      overall_bbox = (
          np.min(f1_values),
          np.min(f2_values),  # x,y of lower left edge
          np.max(f1_values),
          np.max(f2_values),
      )  # x,y of upper right edge
      walk(root, overall_bbox, 0)
  
      return bboxes
  
imports: import os
  import re
  import tempfile
  import warnings
  import xml.etree.cElementTree
  from pathlib import Path
  from sys import platform
  import graphviz
  import numpy
  import pandas
  from matplotlib import patches
  from numpy import ndarray
  from numbers import Number
  from typing import Tuple, Sequence
label_desc: Use image node_id 14 for calling a global function with example usage: tessellate(root, X_train, featidx) and returns: bboxes