code: def make_stumps(tree_struct, normalize=False):
      """
      Create a collection of local decision stumps corresponding to all internal
      nodes in a scikit-learn tree structure object.
  
      Parameters
      ----------
      tree_struct: object
          The scikit-learn tree object
      normalize: bool
          Flag. If set to True, then divide the nonzero function values by
          sqrt(n_samples in node) so that the vector of function values on the
          training set has unit norm. If False, then do not divide, so that the
          vector of function values on the training set has norm equal to
          n_samples in node.
  
      Returns
      -------
      stumps: list of LocalDecisionStump objects
          The local decision stumps corresponding to all internal node in the
          tree structure
  
      """
      stumps = []
  
      def make_stump_iter(
          node_no,
          tree_struct,
          parent_stump,
          is_right_child,
          normalize,
          stumps,
      ):
          """
          Helper function for iteratively making local decision stump objects and
          appending them to the list stumps.
          """
          new_stump = make_stump(
              node_no,
              tree_struct,
              parent_stump,
              is_right_child,
              normalize,
          )
          stumps.append(new_stump)
          left_child = tree_struct.children_left[node_no]
          right_child = tree_struct.children_right[node_no]
          if tree_struct.feature[left_child] != -2:  # is not leaf
              make_stump_iter(
                  left_child,
                  tree_struct,
                  new_stump,
                  False,
                  normalize,
                  stumps,
              )
          if tree_struct.feature[right_child] != -2:  # is not leaf
              make_stump_iter(
                  right_child,
                  tree_struct,
                  new_stump,
                  True,
                  normalize,
                  stumps,
              )
  
      make_stump_iter(0, tree_struct, None, None, normalize, stumps)
      return stumps
  
file_path: imodels/imodels/importance/local_stumps.py
imports: import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: make_stumps(tree_struct, normalize) and returns: stumps