code: def clip_boxes(boxes, im_shape):
      """
      Clip boxes to image boundaries.
      :param boxes: [N, 4]
      :param im_shape: tuple of 2, [h, w]
      :return: [N, 4]
      """
      # x1 >= 0
      boxes[:, 0] = np.clip(boxes[:, 0], 0, im_shape[1] - 1)
      # y1 >= 0
      boxes[:, 1] = np.clip(boxes[:, 1], 0, im_shape[0] - 1)
      # x2 < im_shape[1]
      boxes[:, 2] = np.clip(boxes[:, 2], 1, im_shape[1])
      # y2 < im_shape[0]
      boxes[:, 3] = np.clip(boxes[:, 3], 1, im_shape[0])
      return boxes
  
imports: import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: clip_boxes(boxes, im_shape) and returns: boxes