code: def _calculate_linewidths(ordering, linkage, root):
      linewidths = []
  
      for x in ordering:
          if linkage[x - root][0] >= root:
              left_width = linkage[int(linkage[x - root][0]) - root][3]
          else:
              left_width = 1
  
          if linkage[x - root][1] >= root:
              right_width = linkage[int(linkage[x - root][1]) - root][3]
          else:
              right_width = 1
  
          linewidths.append((left_width, right_width))
  
      return linewidths
  
imports: import numpy
  from scipy.cluster.hierarchy import dendrogram
  from sklearn.manifold import TSNE
  from sklearn.decomposition import PCA
  from sklearn.metrics import pairwise_distances
  from warnings import warn
  from ._hdbscan_tree import compute_stability, labelling_at_cut, recurse_leaf_dfs
label_desc: Use image node_id 5 for calling a global function with example usage: _calculate_linewidths(ordering, linkage, root) and returns: linewidths