code: def draw_masks(
      image: t.Union[pilimage.Image, np.ndarray],
      mask: np.ndarray,
      color: t.Dict[Number, str] = None,
      copy_image: bool = True,
      alpha: float = 0.5,
  ) -> pilimage.Image:
      """Draw mask on the image.
  
      Parameters
      ----------
      image : Union[PIL.Image.Image, numpy.ndarray]
          image to draw on
      mask : numpy.ndarray
          A mask label. Shape of H,W with every value represents the class id at that location.
      copy_image : bool, default True
          copy image before drawing or not
      alpha: float, default 0.5
          Transparency of the mask over the image. When 1 the mask is solid and the image below is hidden
      color: Dict[Number, str]
          color of the masks. A map of class id to the color (either string name or rgb list)
  
      Returns
      -------
      PIL.Image.Image : image instance with masks on it
      """
      if mask.ndim != 2:
          raise ValueError(
              "In order to draw mask it must be in H,W shape"
          )
      image = np.array(ensure_image(image, copy=copy_image))
      image_mask = np.zeros(shape=image.shape)
      classes = set(np.unique(mask))
  
      if color is None:
          color = random_color_dict(len(classes))
  
      for class_id in classes:
          color_to_use = color.get(class_id, "gray")
          if isinstance(color_to_use, str):
              color_to_use = ImageColor.getrgb(color_to_use)
          if len(color_to_use) != 3:
              raise ValueError(f"Got invalid color: {color_to_use}")
  
          rgb_mask = (
              np.stack((mask == class_id,) * 3, axis=-1) * color_to_use
          )
          image_mask = image_mask + rgb_mask
  
      image[image_mask > 0] = (
          image[image_mask > 0] * (1 - alpha)
          + image_mask[image_mask > 0] * alpha
      )
      return pilimage.fromarray(image.astype(np.uint8))
  
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 4 for calling a global function with example usage: draw_masks(image, mask, color, copy_image, alpha) and returns: pilimage