code: def draw_keypoints(
      img: Image,
      keypoints: ndarray,
      scores: ndarray = None,
      thresh: float = 0.2,
      r: int = 2,
      draw_text: bool = False,
      font: str = "arial.ttf",
      font_size: int = 10,
  ):
      if isinstance(img, ndarray):
          img = PIL.Image.fromarray(img)
  
      if scores is None:
          scores = np.ones(keypoints.shape[0])
  
      if draw_text:
          try:
              font = ImageFont.truetype(font, font_size)
          except IOError:
              font = ImageFont.load_default()
  
      draw = ImageDraw.Draw(img)
      for i, (point, score) in enumerate(zip(keypoints, scores)):
          if score > thresh and np.max(point) > 0:
              draw.ellipse(
                  [
                      point[0] - r,
                      point[1] - r,
                      point[0] + r,
                      point[1] + r,
                  ],
                  fill=point_color[i],
                  outline=(255, 255, 255),
              )
              if draw_text:
                  draw.text(
                      (point[0] + r, point[1] + r),
                      text=point_name[i],
                      font=font,
                  )
  
      return img
  
imports: import numpy
  from numpy import ndarray
  import PIL
  from PIL import ImageDraw, ImageFont
  from PIL.Image import Image
label_desc: Use image node_id 1 for calling a global function with example usage: draw_keypoints(img, keypoints, scores, thresh, r, draw_text, font, font_size) and returns: img