code: def _top_spec_for_text_at_bottom(
      text_block, width_per, per_from_bottom=0, min_top=30
  ):
      # This function ensures that if there is a large block of
      # text in your slide it will not overflow off the bottom
      # of the slide.
      # The input for this function are a block of text and the
      # params that define where it will be placed in the slide.
      # The function makes some calculations and will output a
      # 'top' value (i.e. the left, top, height, width css params)
      # so that the text block will come down to some specified
      # distance from the bottom of the page.
  
      # TODO: customize this function for different fonts/sizes
      max_lines = 37
      one_char_percent_width = 0.764
      chars_in_full_line = width_per / one_char_percent_width
  
      num_of_lines = 0
      char_group = 0
      for char in text_block:
          if char == "\n":
              num_of_lines += 1
              char_group = 0
          else:
              if char_group >= chars_in_full_line:
                  char_group = 0
                  num_of_lines += 1
              else:
                  char_group += 1
  
      num_of_lines += 1
      top_frac = (max_lines - num_of_lines) / float(max_lines)
      top = top_frac * 100 - per_from_bottom
  
      # to be safe
      return max(top, min_top)
  
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 9 for calling a global function with example usage: _top_spec_for_text_at_bottom(text_block, width_per, per_from_bottom, min_top) and returns: max