code: def draw_text(
      draw, box_to_display_str_map, box, left, right, top, bottom, color
  ):
      try:
          font = ImageFont.truetype("arial.ttf", 24)
      except IOError:
          font = ImageFont.load_default()
  
      # If the total height of the display strings added to the top of the bounding
      # box exceeds the top of the image, stack the strings below the bounding box
      # instead of above.
      display_str_heights = [
          font.getsize(ds)[1] for ds in box_to_display_str_map[box]
      ]
      # Each display_str has a top and bottom margin of 0.05x.
      total_display_str_height = (1 + 2 * 0.05) * sum(
          display_str_heights
      )
  
      if top > total_display_str_height:
          text_bottom = top
      else:
          text_bottom = bottom + total_display_str_height
      # Reverse list and print from bottom to top.
      for display_str in box_to_display_str_map[box][::-1]:
          text_width, text_height = font.getsize(display_str)
          margin = np.ceil(0.05 * text_height)
          draw.rectangle(
              [
                  (left, text_bottom - text_height - 2 * margin),
                  (left + text_width, text_bottom),
              ],
              fill=color,
          )
          draw.text(
              (left + margin, text_bottom - text_height - margin),
              display_str,
              fill="black",
              font=font,
          )
          text_bottom -= text_height - 2 * margin
  
file_path: deep-learning-for-image-processing/others_project/readPbFile/using_function.py
imports: import collections
  import six
  import PIL.Image
  import PIL.ImageDraw
  import PIL.ImageFont
  import numpy
  import tensorflow
  import cv2
label_desc: Use image node_id 2 for calling a global function with example usage: draw_text(draw, box_to_display_str_map, box, left, right, top, bottom, color) without return types