code: def partition_tree_shuffle(indexes, index_mask, partition_tree):
      """Randomly shuffle the indexes in a way that is consistent with the given partition tree.
  
      Parameters
      ----------
      indexes: np.array
          The output location of the indexes we want shuffled. Note that len(indexes) should equal index_mask.sum().
  
      index_mask: np.array
          A bool mask of which indexes we want to include in the shuffled list.
  
      partition_tree: np.array
          The partition tree we should follow.
      """
      M = len(index_mask)
      # switch = np.random.randn(M) < 0
      _pt_shuffle_rec(
          partition_tree.shape[0] - 1,
          indexes,
          index_mask,
          partition_tree,
          M,
          0,
      )
  
file_path: shap/shap/utils/_clustering.py
imports: import warnings
  import numpy
  import pandas
  import scipy.cluster
  import scipy.spatial
  import sklearn
  from numba import njit
  from ._show_progress import show_progress
label_desc: Use image node_id 2 for calling a global function with example usage: partition_tree_shuffle(indexes, index_mask, partition_tree) without return types