code: def square(bbox, img_shape):
      """Calculate square bounding box
  
      Args:
          bbox (list):[x1, y1, x2, y2]
          img_shape (tuple): (height, width)
  
      Returns:
          bbox (list)
      """
      x1, y1, x2, y2 = bbox
      w, h = x2 - x1 + 1, y2 - y1 + 1
      if w < h:
          pad = (h - w) // 2
          x1 = max(0, x1 - pad)
          x2 = min(img_shape[1], x2 + pad)
      else:
          pad = (w - h) // 2
          y1 = max(0, y1 - pad)
          y2 = min(img_shape[0], y2 + pad)
      return [x1, y1, x2, y2]
  
imports: import numpy
  from PIL import Image, ImageDraw
label_desc: Use image node_id 1 for calling a global function with example usage: square(bbox, img_shape) and returns: list