code: def bbox_clip_xyxy(
      xyxy: Optional[Union[list, tuple, np.ndarray]],
      width: Optional[Union[int, float]],
      height: Optional[Union[int, float]],
  ):
      """
      Clip bounding box with format (xmin, ymin, xmax, ymax) to specified boundary. Modified from gluon cv.
      All bounding boxes will be clipped to the new region `(0, 0, width, height)`.
  
      Parameters
      ----------
      xyxy
          The bbox in format (xmin, ymin, xmax, ymax).
          If numpy.ndarray is provided, we expect multiple bounding boxes with
          shape `(N, 4)`.
      width
          Boundary width.
      height
          Boundary height.
  
      Returns
      -------
      A tuple or numpy.ndarray.
      The clipped bboxes in format (xmin, ymin, xmax, ymax).
      If input is numpy.ndarray, return is numpy.ndarray correspondingly.
      """
      if isinstance(xyxy, (tuple, list)):
          if not len(xyxy) == 4:
              raise IndexError(
                  "Bounding boxes must have 4 elements, given {}".format(
                      len(xyxy)
                  )
              )
          x1 = np.minimum(width - 1, np.maximum(0, xyxy[0]))
          y1 = np.minimum(height - 1, np.maximum(0, xyxy[1]))
          x2 = np.minimum(width - 1, np.maximum(0, xyxy[2]))
          y2 = np.minimum(height - 1, np.maximum(0, xyxy[3]))
          return x1, y1, x2, y2
      elif isinstance(xyxy, np.ndarray):
          if not xyxy.size % 4 == 0:
              raise IndexError(
                  "Bounding boxes must have n * 4 elements, given {}".format(
                      xyxy.shape
                  )
              )
          x1 = np.minimum(width - 1, np.maximum(0, xyxy[:, 0]))
          y1 = np.minimum(height - 1, np.maximum(0, xyxy[:, 1]))
          x2 = np.minimum(width - 1, np.maximum(0, xyxy[:, 2]))
          y2 = np.minimum(height - 1, np.maximum(0, xyxy[:, 3]))
          return np.hstack((x1, y1, x2, y2))
      else:
          raise TypeError(
              "Expect input xywh a list, tuple or numpy.ndarray, given {}".format(
                  type(xyxy)
              )
          )
  
imports: import json
  import logging
  import os
  import warnings
  from pathlib import Path
  from typing import Dict, Iterable, List, Optional, Union
  import defusedxml.ElementTree
  import numpy
  import pandas
  import PIL
  from torchmetrics.detection.mean_ap import MeanAveragePrecision
  from ..constants import BBOX, LABEL, MAP, MAP_50, MAP_75, MAP_LARGE, MAP_MEDIUM, MAP_SMALL, MAR_1, MAR_10, MAR_100, MAR_LARGE, MAR_MEDIUM, MAR_SMALL, MEAN_AVERAGE_PRECISION
  from .download import download, is_url
label_desc: Use image node_id 15 for calling a global function with example usage: bbox_clip_xyxy(xyxy, width, height) and returns: x1,  y1,  x2,  y2, np