code: def _return_layout_specs(
      num_of_boxes,
      url_lines,
      title_lines,
      text_block,
      code_blocks,
      slide_num,
      style,
  ):
      # returns specs of the form (left, top, height, width)
      code_theme = "tomorrowNight"
      if style == "martik":
          specs_for_boxes = []
          margin = 18  # in pxs
  
          # set Headings styles
          paragraph_styles["Heading 1"].update(
              {
                  "color": "#0D0A1E",
                  "fontFamily": "Raleway",
                  "fontSize": 55,
                  "fontWeight": fontWeight_dict["Bold"]["fontWeight"],
              }
          )
  
          paragraph_styles["Heading 2"] = copy.deepcopy(
              paragraph_styles["Heading 1"]
          )
          paragraph_styles["Heading 2"].update({"fontSize": 36})
          paragraph_styles["Heading 3"] = copy.deepcopy(
              paragraph_styles["Heading 1"]
          )
          paragraph_styles["Heading 3"].update({"fontSize": 30})
  
          # set Body style
          paragraph_styles["Body"].update(
              {
                  "color": "#96969C",
                  "fontFamily": "Roboto",
                  "fontSize": 16,
                  "fontWeight": fontWeight_dict["Regular"][
                      "fontWeight"
                  ],
              }
          )
  
          bkgd_color = "#F4FAFB"
          title_font_color = "#0D0A1E"
          text_font_color = "#96969C"
          if num_of_boxes == 0 and slide_num == 0:
              text_textAlign = "center"
          else:
              text_textAlign = "left"
          if num_of_boxes == 0:
              specs_for_title = (0, 50, 20, 100)
              specs_for_text = (15, 60, 50, 70)
  
              bkgd_color = "#0D0A1E"
              title_font_color = "#F4FAFB"
              text_font_color = "#F4FAFB"
          elif num_of_boxes == 1:
              if code_blocks != [] or (
                  url_lines != []
                  and get_config()["plotly_domain"] in url_lines[0]
              ):
                  if code_blocks != []:
                      w_range = 40
                  else:
                      w_range = 60
                  text_top = _top_spec_for_text_at_bottom(
                      text_block,
                      80,
                      per_from_bottom=(margin / HEIGHT) * 100,
                  )
                  specs_for_title = (0, 3, 20, 100)
                  specs_for_text = (10, text_top, 30, 80)
                  specs_for_boxes = _box_specs_gen(
                      num_of_boxes,
                      grouptype="middle",
                      width_range=w_range,
                      height_range=60,
                      margin=margin,
                      betw_boxes=4,
                  )
                  bkgd_color = "#0D0A1E"
                  title_font_color = "#F4FAFB"
                  text_font_color = "#F4FAFB"
                  code_theme = "tomorrow"
              elif title_lines == [] and text_block == "":
                  specs_for_title = (0, 50, 20, 100)
                  specs_for_text = (15, 60, 50, 70)
                  specs_for_boxes = _box_specs_gen(
                      num_of_boxes,
                      grouptype="middle",
                      width_range=50,
                      height_range=80,
                      margin=0,
                      betw_boxes=0,
                  )
              else:
                  title_text_width = 40 - (margin / WIDTH) * 100
  
                  text_top = _top_spec_for_text_at_bottom(
                      text_block,
                      title_text_width,
                      per_from_bottom=(margin / HEIGHT) * 100,
                  )
                  specs_for_title = (60, 3, 20, 40)
                  specs_for_text = (60, text_top, 1, title_text_width)
                  specs_for_boxes = _box_specs_gen(
                      num_of_boxes,
                      grouptype="leftgroup_v",
                      width_range=60,
                      margin=margin,
                      betw_boxes=4,
                  )
                  bkgd_color = "#0D0A1E"
                  title_font_color = "#F4FAFB"
                  text_font_color = "#F4FAFB"
          elif num_of_boxes == 2 and url_lines != []:
              text_top = _top_spec_for_text_at_bottom(
                  text_block,
                  46,
                  per_from_bottom=(margin / HEIGHT) * 100,
                  min_top=50,
              )
              specs_for_title = (0, 3, 20, 50)
              specs_for_text = (52, text_top, 40, 46)
              specs_for_boxes = _box_specs_gen(
                  num_of_boxes, grouptype="checkerboard_topright"
              )
          elif num_of_boxes >= 2 and url_lines == []:
              text_top = _top_spec_for_text_at_bottom(
                  text_block,
                  92,
                  per_from_bottom=(margin / HEIGHT) * 100,
                  min_top=15,
              )
              if num_of_boxes == 2:
                  betw_boxes = 90
              else:
                  betw_boxes = 10
              specs_for_title = (0, 3, 20, 100)
              specs_for_text = (4, text_top, 1, 92)
              specs_for_boxes = _box_specs_gen(
                  num_of_boxes,
                  grouptype="middle",
                  width_range=92,
                  height_range=60,
                  margin=margin,
                  betw_boxes=betw_boxes,
              )
              code_theme = "tomorrow"
          else:
              text_top = _top_spec_for_text_at_bottom(
                  text_block,
                  40 - (margin / WIDTH) * 100,
                  per_from_bottom=(margin / HEIGHT) * 100,
              )
              specs_for_title = (0, 3, 20, 40 - (margin / WIDTH) * 100)
              specs_for_text = (
                  (margin / WIDTH) * 100,
                  text_top,
                  50,
                  40 - (margin / WIDTH) * 100,
              )
              specs_for_boxes = _box_specs_gen(
                  num_of_boxes,
                  grouptype="rightgroup_v",
                  width_range=60,
                  margin=margin,
                  betw_boxes=4,
              )
  
      elif style == "moods":
          specs_for_boxes = []
          margin = 18
          code_theme = "tomorrowNight"
  
          # set Headings styles
          paragraph_styles["Heading 1"].update(
              {
                  "color": "#000016",
                  "fontFamily": "Roboto",
                  "fontSize": 55,
                  "fontWeight": fontWeight_dict["Black"]["fontWeight"],
              }
          )
  
          paragraph_styles["Heading 2"] = copy.deepcopy(
              paragraph_styles["Heading 1"]
          )
          paragraph_styles["Heading 2"].update({"fontSize": 36})
          paragraph_styles["Heading 3"] = copy.deepcopy(
              paragraph_styles["Heading 1"]
          )
          paragraph_styles["Heading 3"].update({"fontSize": 30})
  
          # set Body style
          paragraph_styles["Body"].update(
              {
                  "color": "#000016",
                  "fontFamily": "Roboto",
                  "fontSize": 16,
                  "fontWeight": fontWeight_dict["Thin"]["fontWeight"],
              }
          )
  
          bkgd_color = "#FFFFFF"
          title_font_color = None
          text_font_color = None
          if num_of_boxes == 0 and slide_num == 0:
              text_textAlign = "center"
          else:
              text_textAlign = "left"
          if num_of_boxes == 0:
              if slide_num == 0 or text_block == "":
                  bkgd_color = "#F7F7F7"
                  specs_for_title = (0, 50, 20, 100)
                  specs_for_text = (15, 60, 50, 70)
              else:
                  bkgd_color = "#F7F7F7"
                  text_top = _top_spec_for_text_at_bottom(
                      text_block,
                      width_per=90,
                      per_from_bottom=(margin / HEIGHT) * 100,
                      min_top=20,
                  )
                  specs_for_title = (0, 2, 20, 100)
                  specs_for_text = (5, text_top, 50, 90)
  
          elif num_of_boxes == 1:
              if code_blocks != []:
                  # code
                  if text_block == "":
                      margin = 5
                      specs_for_title = (0, 3, 20, 100)
                      specs_for_text = (0, 0, 0, 0)
                      top = 12
                      specs_for_boxes = [
                          (
                              margin,
                              top,
                              100 - top - margin,
                              100 - 2 * margin,
                          )
                      ]
  
                  elif slide_num % 2 == 0:
                      # middle center
                      width_per = 90
                      height_range = 60
                      text_top = _top_spec_for_text_at_bottom(
                          text_block,
                          width_per=width_per,
                          per_from_bottom=(margin / HEIGHT) * 100,
                          min_top=100 - height_range / 2.0,
                      )
                      specs_for_boxes = _box_specs_gen(
                          num_of_boxes,
                          grouptype="middle",
                          width_range=50,
                          height_range=60,
                          margin=margin,
                      )
                      specs_for_title = (0, 3, 20, 100)
                      specs_for_text = (5, text_top, 2, width_per)
                  else:
                      # right
                      width_per = 50
                      text_top = _top_spec_for_text_at_bottom(
                          text_block,
                          width_per=width_per,
                          per_from_bottom=(margin / HEIGHT) * 100,
                          min_top=30,
                      )
                      specs_for_boxes = _box_specs_gen(
                          num_of_boxes,
                          grouptype="rightgroup_v",
                          width_range=50,
                          margin=40,
                      )
                      specs_for_title = (0, 3, 20, 50)
                      specs_for_text = (2, text_top, 2, width_per - 2)
              elif (
                  url_lines != []
                  and get_config()["plotly_domain"] in url_lines[0]
              ):
                  # url
                  if slide_num % 2 == 0:
                      # top half
                      width_per = 95
                      text_top = _top_spec_for_text_at_bottom(
                          text_block,
                          width_per=width_per,
                          per_from_bottom=(margin / HEIGHT) * 100,
                          min_top=60,
                      )
                      specs_for_boxes = _box_specs_gen(
                          num_of_boxes,
                          grouptype="middle",
                          width_range=100,
                          height_range=60,
                          middle_center=30,
                      )
                      specs_for_title = (0, 60, 20, 100)
                      specs_for_text = (2.5, text_top, 2, width_per)
                  else:
                      # middle across
                      width_per = 95
                      text_top = _top_spec_for_text_at_bottom(
                          text_block,
                          width_per=width_per,
                          per_from_bottom=(margin / HEIGHT) * 100,
                          min_top=60,
                      )
                      specs_for_boxes = _box_specs_gen(
                          num_of_boxes,
                          grouptype="middle",
                          width_range=100,
                          height_range=60,
                      )
                      specs_for_title = (0, 3, 20, 100)
                      specs_for_text = (2.5, text_top, 2, width_per)
              else:
                  # image
                  if slide_num % 2 == 0:
                      # right
                      width_per = 50
                      text_top = _top_spec_for_text_at_bottom(
                          text_block,
                          width_per=width_per,
                          per_from_bottom=(margin / HEIGHT) * 100,
                          min_top=30,
                      )
                      specs_for_boxes = _box_specs_gen(
                          num_of_boxes,
                          grouptype="rightgroup_v",
                          width_range=50,
                          margin=0,
                      )
                      specs_for_title = (0, 3, 20, 50)
                      specs_for_text = (2, text_top, 2, width_per - 2)
                  else:
                      # left
                      width_per = 50
                      text_top = _top_spec_for_text_at_bottom(
                          text_block,
                          width_per=width_per,
                          per_from_bottom=(margin / HEIGHT) * 100,
                          min_top=30,
                      )
                      specs_for_boxes = _box_specs_gen(
                          num_of_boxes,
                          grouptype="leftgroup_v",
                          width_range=50,
                          margin=0,
                      )
                      specs_for_title = (50, 3, 20, 50)
                      specs_for_text = (52, text_top, 2, width_per - 2)
          elif num_of_boxes == 2:
              # right stack
              width_per = 50
              text_top = _top_spec_for_text_at_bottom(
                  text_block,
                  width_per=width_per,
                  per_from_bottom=(margin / HEIGHT) * 100,
                  min_top=30,
              )
              specs_for_boxes = [(50, 0, 50, 50), (50, 50, 50, 50)]
              specs_for_title = (0, 3, 20, 50)
              specs_for_text = (2, text_top, 2, width_per - 2)
          elif num_of_boxes == 3:
              # middle top
              width_per = 95
              text_top = _top_spec_for_text_at_bottom(
                  text_block,
                  width_per=width_per,
                  per_from_bottom=(margin / HEIGHT) * 100,
                  min_top=40,
              )
              specs_for_boxes = _box_specs_gen(
                  num_of_boxes,
                  grouptype="middle",
                  width_range=100,
                  height_range=40,
                  middle_center=30,
              )
              specs_for_title = (0, 0, 20, 100)
              specs_for_text = (2.5, text_top, 2, width_per)
          else:
              # right stack
              width_per = 40
              text_top = _top_spec_for_text_at_bottom(
                  text_block,
                  width_per=width_per,
                  per_from_bottom=(margin / HEIGHT) * 100,
                  min_top=30,
              )
              specs_for_boxes = _box_specs_gen(
                  num_of_boxes,
                  grouptype="rightgroup_v",
                  width_range=60,
                  margin=0,
              )
              specs_for_title = (0, 3, 20, 40)
              specs_for_text = (2, text_top, 2, width_per - 2)
  
      # set text style attributes
      title_style_attr = {}
      text_style_attr = {"textAlign": text_textAlign}
  
      if text_font_color:
          text_style_attr["color"] = text_font_color
      if title_font_color:
          title_style_attr["color"] = title_font_color
  
      return (
          specs_for_boxes,
          specs_for_title,
          specs_for_text,
          bkgd_color,
          title_style_attr,
          text_style_attr,
          code_theme,
      )
  
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 11 for calling a global function with example usage: _return_layout_specs(num_of_boxes, url_lines, title_lines, text_block, code_blocks, slide_num, style) and returns: specs_for_boxes,  specs_for_title,  specs_for_text,  bkgd_color,  title_style_attr,  text_style_attr,  code_theme