code: def traverse_upwards(
      cluster_tree,
      cluster_selection_epsilon,
      leaf,
      allow_single_cluster,
  ):
      root = cluster_tree["parent"].min()
      parent = cluster_tree[cluster_tree["child"] == leaf]["parent"]
      if parent == root:
          if allow_single_cluster:
              return parent
          else:
              return leaf  # return node closest to root
  
      parent_eps = (
          1
          / cluster_tree[cluster_tree["child"] == parent]["lambda_val"]
      )
      if parent_eps > cluster_selection_epsilon:
          return parent
      else:
          return traverse_upwards(
              cluster_tree,
              cluster_selection_epsilon,
              parent,
              allow_single_cluster,
          )
  
imports: import copy
  from warnings import warn
  import numpy
  from ._hdbscan_tree import compute_stability, get_cluster_tree_leaves
  from .hdbscan_ import HDBSCAN, _tree_to_labels
  from .plots import _bfs_from_cluster_tree
  from .prediction import PredictionData, _find_cluster_and_probability, _find_neighbor_and_lambda
  from ._prediction_utils import get_tree_row_with_child, dist_membership_vector, outlier_membership_vector, prob_in_some_cluster, all_points_dist_membership_vector, all_points_outlier_membership_vector, all_points_prob_in_some_cluster
label_desc: Use image node_id 11 for calling a global function with example usage: traverse_upwards(cluster_tree, cluster_selection_epsilon, leaf, allow_single_cluster) and returns: parent, traverse_upwards, parent, leaf