code: def bbox_clip(bboxes, img_shape):
      """Clip bboxes to fit the image shape.
  
      Args:
          bboxes (ndarray): Shape (..., 4*k)
          img_shape (tuple[int]): (height, width) of the image.
  
      Returns:
          ndarray: Clipped bboxes.
      """
      assert bboxes.shape[-1] % 4 == 0
      cmin = np.empty(bboxes.shape[-1], dtype=bboxes.dtype)
      cmin[0::2] = img_shape[1] - 1
      cmin[1::2] = img_shape[0] - 1
      clipped_bboxes = np.maximum(np.minimum(bboxes, cmin), 0)
      return clipped_bboxes
  
imports: import numbers
  import cv2
  import numpy
  from ..utils import to_2tuple
  from .io import imread_backend
label_desc: Use image node_id 10 for calling a global function with example usage: bbox_clip(bboxes, img_shape) and returns: clipped_bboxes