code: def _order_cluster_tree(Z):
      """
      Return clustering nodes in bottom-up order by distance.
  
      Parameters
      ----------
      Z : scipy.cluster.linkage array
          The linkage matrix.
  
      Returns
      -------
      nodes : list
          A list of ClusterNode objects.
      """
      q = deque()
      tree = to_tree(Z)
      q.append(tree)
      nodes = []
  
      while q:
          node = q.popleft()
          if not node.is_leaf():
              bisect.insort_left(nodes, node)
              q.append(node.get_right())
              q.append(node.get_left())
      return nodes
  
imports: import warnings
  import bisect
  from collections import deque
  import numpy
  from .None import _hierarchy, _optimal_leaf_ordering
  import scipy.spatial.distance
  from scipy._lib._array_api import array_namespace, as_xparray, copy
  from scipy._lib._disjoint_set import DisjointSet
label_desc: Use image node_id 11 for calling a global function with example usage: _order_cluster_tree(Z) and returns: nodes