code: def get_font_with_size(text, desired_width):
      font_size = 1
      here = Path(__file__)
      font_file = (
          here.parent.parent
          / "fonts"
          / "quicksand"
          / "Quicksand-Bold.otf"
      )
      font = ImageFont.truetype(str(font_file), font_size)
      # Don't want to have size too small
      desired_width = max(100, desired_width)
      jump_size = 100
      while jump_size > 1:
          left, _, right, _ = font.getbbox(text)
          width = right - left
          if width < desired_width:
              font_size += jump_size
          else:
              jump_size = jump_size // 2
              font_size -= jump_size
          font = ImageFont.truetype(str(font_file), font_size)
  
      return font
  
imports: import io
  import typing
  from numbers import Number
  from pathlib import Path
  import cv2
  import numpy
  import PIL.Image
  import PIL.ImageDraw
  import PIL.ImageOps
  import plotly.graph_objects
  from PIL import ImageColor, ImageFont
  from deepchecks.core.errors import DeepchecksValueError
  from deepchecks.utils.html import imagetag
  from deepchecks.vision.vision_data import TaskType
  from deepchecks.vision.vision_data.utils import LabelMap
  from .detection_formatters import convert_bbox
label_desc: Use image node_id 5 for calling a global function with example usage: get_font_with_size(text, desired_width) and returns: font