code: def _box_specs_gen(
      num_of_boxes,
      grouptype="leftgroup_v",
      width_range=50,
      height_range=50,
      margin=2,
      betw_boxes=4,
      middle_center=50,
  ):
      # the (left, top, width, height) specs
      # are added to specs_for_boxes
      specs_for_boxes = []
      if num_of_boxes == 1 and grouptype in [
          "leftgroup_v",
          "rightgroup_v",
      ]:
          if grouptype == "rightgroup_v":
              left_shift = 100 - width_range
          else:
              left_shift = 0
  
          box_spec = (
              left_shift + (margin / WIDTH) * 100,
              (margin / HEIGHT) * 100,
              100 - (2 * margin / HEIGHT * 100),
              width_range - (2 * margin / WIDTH) * 100,
          )
          specs_for_boxes.append(box_spec)
  
      elif num_of_boxes > 1 and grouptype in [
          "leftgroup_v",
          "rightgroup_v",
      ]:
          if grouptype == "rightgroup_v":
              left_shift = 100 - width_range
          else:
              left_shift = 0
  
          if num_of_boxes % 2 == 0:
              box_width_px = 0.5 * (
                  (float(width_range) / 100) * WIDTH
                  - 2 * margin
                  - betw_boxes
              )
              box_width = (box_width_px / WIDTH) * 100
  
              height = (200.0 / (num_of_boxes * HEIGHT)) * (
                  HEIGHT
                  - (num_of_boxes / 2 - 1) * betw_boxes
                  - 2 * margin
              )
  
              left1 = left_shift + (margin / WIDTH) * 100
              left2 = left_shift + (
                  ((margin + betw_boxes) / WIDTH) * 100 + box_width
              )
              for left in [left1, left2]:
                  for j in range(int(num_of_boxes / 2)):
                      top = (margin * 100 / HEIGHT) + j * (
                          height + (betw_boxes * 100 / HEIGHT)
                      )
                      specs = (left, top, height, box_width)
                      specs_for_boxes.append(specs)
  
          if num_of_boxes % 2 == 1:
              width = width_range - (200 * margin) / WIDTH
              height = (100.0 / (num_of_boxes * HEIGHT)) * (
                  HEIGHT - (num_of_boxes - 1) * betw_boxes - 2 * margin
              )
              left = left_shift + (margin / WIDTH) * 100
              for j in range(num_of_boxes):
                  top = (margin / HEIGHT) * 100 + j * (
                      height + (betw_boxes / HEIGHT) * 100
                  )
                  specs = (left, top, height, width)
                  specs_for_boxes.append(specs)
  
      elif grouptype == "middle":
          top = float(middle_center - (height_range / 2))
          height = height_range
          width = (1 / float(num_of_boxes)) * (
              width_range
              - (num_of_boxes - 1) * (100 * betw_boxes / WIDTH)
          )
          for j in range(num_of_boxes):
              left = ((100 - float(width_range)) / 2) + j * (
                  width + (betw_boxes / WIDTH) * 100
              )
              specs = (left, top, height, width)
              specs_for_boxes.append(specs)
  
      elif "checkerboard" in grouptype and num_of_boxes == 2:
          if grouptype == "checkerboard_topleft":
              for j in range(2):
                  left = j * 50
                  top = j * 50
                  height = 50
                  width = 50
                  specs = (left, top, height, width)
                  specs_for_boxes.append(specs)
          else:
              for j in range(2):
                  left = 50 * (1 - j)
                  top = j * 50
                  height = 50
                  width = 50
                  specs = (left, top, height, width)
                  specs_for_boxes.append(specs)
      return specs_for_boxes
  
imports: import copy
  import random
  import re
  import string
  import warnings
  import _plotly_utils.exceptions
  from chart_studio import exceptions
  from chart_studio.config import get_config
label_desc: Use image node_id 10 for calling a global function with example usage: _box_specs_gen(num_of_boxes, grouptype, width_range, height_range, margin, betw_boxes, middle_center) and returns: specs_for_boxes