code: def _box(
      boxtype,
      text_or_url,
      left,
      top,
      height,
      width,
      id,
      props_attr,
      style_attr,
      paragraphStyle,
  ):
      children_list = []
      fontFamily = (
          "Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace"
      )
      if boxtype == "Text":
          children_list = text_or_url.split("\n")
  
          props = {
              "isQuote": False,
              "listType": None,
              "paragraphStyle": paragraphStyle,
              "size": 4,
              "style": copy.deepcopy(paragraph_styles[paragraphStyle]),
          }
  
          props["style"].update(
              {
                  "height": height,
                  "left": left,
                  "top": top,
                  "width": width,
                  "position": "absolute",
              }
          )
  
      elif boxtype == "Image":
          # height, width are set to default 512
          # as set by the Presentation Editor
          props = {
              "height": 512,
              "imageName": None,
              "src": text_or_url,
              "style": {
                  "height": height,
                  "left": left,
                  "opacity": 1,
                  "position": "absolute",
                  "top": top,
                  "width": width,
              },
              "width": 512,
          }
      elif boxtype == "Plotly":
          if "?share_key" in text_or_url:
              src = text_or_url
          else:
              src = text_or_url + ".embed?link=false"
          props = {
              "frameBorder": 0,
              "scrolling": "no",
              "src": src,
              "style": {
                  "height": height,
                  "left": left,
                  "position": "absolute",
                  "top": top,
                  "width": width,
              },
          }
      elif boxtype == "CodePane":
          props = {
              "language": "python",
              "source": text_or_url,
              "style": {
                  "fontFamily": fontFamily,
                  "fontSize": 13,
                  "height": height,
                  "left": left,
                  "margin": 0,
                  "position": "absolute",
                  "textAlign": "left",
                  "top": top,
                  "width": width,
              },
              "theme": "tomorrowNight",
          }
  
      # update props and style attributes
      for item in props_attr.items():
          props[item[0]] = item[1]
      for item in style_attr.items():
          props["style"][item[0]] = item[1]
  
      child = {
          "children": children_list,
          "id": id,
          "props": props,
          "type": boxtype,
      }
  
      if boxtype == "Text":
          child["defaultHeight"] = 36
          child["defaultWidth"] = 52
          child["resizeVertical"] = False
      if boxtype == "CodePane":
          child["defaultText"] = "Code"
  
      return child
  
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 4 for calling a global function with example usage: _box(boxtype, text_or_url, left, top, height, width, id, props_attr, style_attr, paragraphStyle) and returns: child