code: def sample_split_condition(
      node: LeafNode,
  ) -> Optional[Tuple[SplitCondition, SplitCondition]]:
      """
      Randomly sample a splitting rule for a particular leaf node
      Works based on two random draws
  
        - draw a node to split on based on multinomial distribution
        - draw an observation within that variable to split on
  
      Returns None if there isn't a possible non-degenerate split
      """
      split_variable = np.random.choice(
          list(node.split.data.X.splittable_variables())
      )
      split_value = node.data.X.random_splittable_value(split_variable)
      if split_value is None:
          return None
      return SplitCondition(
          split_variable, split_value, le
      ), SplitCondition(split_variable, split_value, gt)
  
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 5 for calling a global function with example usage: sample_split_condition(node) and returns: SplitCondition,  SplitCondition, None