code: def _get_leaf_split_indices(tree_structure):
      leaf_index = {}  # leaf id => (parent_id, leaf)
      split_index = {}  # split id => (parent_id, subtree)
  
      def walk(tree, parent_id=-1):
          if "leaf_index" in tree:
              # regular leaf
              leaf_index[tree["leaf_index"]] = (parent_id, tree)
          elif "split_index" not in tree:
              # one-leaf tree producing a constant without splits
              leaf_index[0] = (parent_id, tree)
          else:
              # split node
              split_index[tree["split_index"]] = (parent_id, tree)
              walk(tree["left_child"], tree["split_index"])
              walk(tree["right_child"], tree["split_index"])
  
      walk(tree_structure)
      return leaf_index, split_index
  
file_path: eli5/eli5/lightgbm.py
imports: from __future__ import absolute_import, division
  from collections import defaultdict
  from typing import DefaultDict, Optional
  import numpy
  import lightgbm
  from eli5.explain import explain_weights, explain_prediction
  from eli5._feature_importances import get_feature_importance_explanation
  from eli5.sklearn.utils import handle_vec, get_X, get_X0, add_intercept, predict_proba
  from eli5._decision_path import get_decision_path_explanation
label_desc: Use image node_id 8 for calling a global function with example usage: _get_leaf_split_indices(tree_structure) and returns: leaf_index,  split_index