code: def _parse_tree_dump(text_dump):
      # type: (str) -> Optional[Dict[str, Any]]
      """Parse text tree dump (one item of a list returned by Booster.get_dump())
      into json format that will be used by next XGBoost release.
      """
      result = None
      stack = []  # type: List[Dict]
      for line in text_dump.split("\n"):
          if line:
              depth, node = _parse_dump_line(line)
              if depth == 0:
                  assert not stack
                  result = node
                  stack.append(node)
              elif depth > len(stack):
                  raise ValueError("Unexpected dump structure")
              else:
                  if depth < len(stack):
                      stack = stack[:depth]
                  stack[-1].setdefault("children", []).append(node)
                  stack.append(node)
      return result
  
imports: from __future__ import absolute_import
  from functools import partial
  import re
  from typing import Any, Dict, List, Tuple, Optional, Pattern
  import numpy
  import scipy.sparse
  from xgboost import XGBClassifier, XGBRegressor, Booster, DMatrix
  from eli5.explain import explain_weights, explain_prediction
  from eli5.sklearn.utils import add_intercept, get_X, get_X0, handle_vec, predict_proba
  from eli5.utils import is_sparse_vector
  from eli5._decision_path import get_decision_path_explanation
  from eli5._feature_importances import get_feature_importance_explanation
label_desc: Use image node_id 10 for calling a global function with example usage: _parse_tree_dump(text_dump) and returns: result