code: def random_splittable_leaf_node(tree: Tree) -> LeafNode:
      """
      Returns a random leaf node that can be split in a non-degenerate way
      i.e. a random draw from the set of leaf nodes that have at least two distinct values in their covariate matrix
      """
      splittable_nodes = tree.splittable_leaf_nodes
      if len(splittable_nodes) == 0:
          raise NoSplittableVariableException()
      else:
          return np.random.choice(splittable_nodes)
  
file_path: imodels/imodels/experimental/bartpy/samplers/unconstrainedtree/proposer.py
imports: from operator import le, gt
  from typing import Callable, List, Mapping, Optional, Tuple
  import numpy
  from ...errors import NoSplittableVariableException, NoPrunableNodeException
  from ...mutation import TreeMutation, GrowMutation, PruneMutation
  from ...node import LeafNode, DecisionNode, split_node
  from ...samplers.scalar import DiscreteSampler
  from ...samplers.treemutation import TreeMutationProposer
  from ...split import SplitCondition
  from ...tree import Tree
label_desc: Use image node_id 3 for calling a global function with example usage: random_splittable_leaf_node(tree) and returns: np