code: def sort_tempo(tempo):
      """
      Sort tempi according to their strengths.
  
      Parameters
      ----------
      tempo : numpy array, shape (num_tempi, 2)
          Tempi (first column) and their relative strength (second column).
  
      Returns
      -------
      tempi : numpy array, shape (num_tempi, 2)
          Tempi sorted according to their strength.
  
      """
      tempo = np.array(tempo, copy=False, ndmin=1)
      if tempo.ndim != 2:
          raise ValueError(
              "`tempo` has no strength information, cannot sort "
              "them."
          )
      tempi = tempo[:, 0]
      strengths = tempo[:, 1]
      # Note: use 'mergesort', because we want a stable sorting algorithm
      #       which keeps the order of the keys in case of duplicate keys
      #       but we need to apply this (-strengths) trick because we want
      #       tempi with uniformly distributed strengths to keep their order
      sort_idx = (-strengths).argsort(kind="mergesort")
      tempi = tempi[sort_idx]
      strengths = strengths[sort_idx]
      return np.vstack((tempi, strengths)).T
  
imports: from __future__ import absolute_import, division, print_function
  import warnings
  import numpy
  from .None import EvaluationMixin, MeanEvaluation, evaluation_io
  from ..io import load_tempo
label_desc: Use image node_id 1 for calling a global function with example usage: sort_tempo(tempo) and returns: np