code: def sort_boxes_by_confidence(boxes: np.ndarray) -> np.ndarray:
      """Sort boxes according the confidence in descending order.
  
        It is using merge sort to agree with COCO metrics.
  
      Args:
       boxes: a numpy array representing the bounding boxes in the following format
         [LEFT, TOP, RIGHT, BOTTOM, CLASS, CONFIDENCE]
  
      Returns:
       sorted_boxes: the sorted list of bounding boxes
      """
      if boxes.ndim != 2:
          raise ValueError(
              f"Input boxes list should be a 2d array of shape "
              f"( <batch_size>, {CONFIDENCE}+)"
          )
  
      if boxes.shape[1] <= CONFIDENCE:
          warnings.warn(
              "The axis for sort does not exist, return the original data"
          )
          return boxes
      inds = np.argsort(-boxes[:, CONFIDENCE], kind="mergesort")
      return boxes[inds]
  
imports: from typing import Iterable, Tuple
  import warnings
  import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: sort_boxes_by_confidence(boxes) and returns: boxes, boxes