code: def remap_condensed_tree(tree, internal_to_raw, outliers):
      """
      Takes an internal condensed_tree structure and adds back in a set of points
      that were initially detected as non-finite and returns that new tree.
      These points will all be split off from the maximal node at lambda zero and
      considered noise points.
  
      Parameters
      ----------
      tree: condensed_tree
      internal_to_raw: dict
          a mapping from internal integer index to the raw integer index
      finite_index: ndarray
          Boolean array of which entries in the raw data were finite
      """
      finite_count = len(internal_to_raw)
  
      outlier_count = len(outliers)
      for i, (parent, child, lambda_val, child_size) in enumerate(tree):
          if child < finite_count:
              child = internal_to_raw[child]
          else:
              child = child + outlier_count
          tree[i] = (
              parent + outlier_count,
              child,
              lambda_val,
              child_size,
          )
  
      outlier_list = []
      root = tree[0][
          0
      ]  # Should I check to be sure this is the minimal lambda?
      for outlier in outliers:
          outlier_list.append((root, outlier, 0, 1))
  
      outlier_tree = np.array(
          outlier_list,
          dtype=[
              ("parent", np.intp),
              ("child", np.intp),
              ("lambda_val", float),
              ("child_size", np.intp),
          ],
      )
      tree = np.append(outlier_tree, tree)
      return tree
  
imports: import numpy
  from sklearn.base import BaseEstimator, ClusterMixin
  from sklearn.metrics import pairwise_distances
  from scipy.sparse import issparse
  from sklearn.neighbors import KDTree, BallTree
  from joblib import Memory
  from warnings import warn
  from sklearn.utils import check_array
  from joblib.parallel import cpu_count
  from scipy.sparse import csgraph
  from ._hdbscan_linkage import single_linkage, mst_linkage_core, mst_linkage_core_vector, label
  from ._hdbscan_tree import condense_tree, compute_stability, get_clusters, outlier_scores
  from ._hdbscan_reachability import mutual_reachability, sparse_mutual_reachability
  from ._hdbscan_boruvka import KDTreeBoruvkaAlgorithm, BallTreeBoruvkaAlgorithm
  from .dist_metrics import DistanceMetric
  from .plots import CondensedTree, SingleLinkageTree, MinimumSpanningTree
  from .prediction import PredictionData
  from numpy import isclose
label_desc: Use image node_id 9 for calling a global function with example usage: remap_condensed_tree(tree, internal_to_raw, outliers) and returns: tree