code: def get_leaves(root: dict):
      """
      returns the leaf nodes (list of dicts) from a single surrogate tree.
      :param root:
      :return:
      """
      nodes = []
  
      def _recurse(root):
          is_split_node = "cutoff" in root
          if is_split_node:
              _recurse(root["left"])
              _recurse(root["right"])
          else:
              nodes.append(root)
  
      _recurse(root)
      return nodes
  
imports: import numpy
  import pandas
  from aix360.algorithms.imd.rule import Rule
label_desc: Use image node_id 2 for calling a global function with example usage: get_leaves(root) and returns: nodes