code: def draw_mask(
      img: np.ndarray,
      mask: MaskArray,
      color: Tuple[int, int, int],
      blend: float = 0.5,
      border_thickness: int = 7,
  ):
      # Border thickness must be an odd integer
      if border_thickness % 2 == 0:
          # TODO: Shall we throw an error, or change the value to the nearest
          # even integer automatically and raise a warning?
          raise ValueError(
              f"`border_thickness` must be an odd number. You entered {border_thickness}"
          )
      img = PIL.Image.fromarray(img)
      w, h = img.size
  
      mask_idxs = np.where(mask.data)
  
      # Add alpha with 0 transparency. We draw the mask with border color first
      color = np.append(color, 255)
      mask_arr = np.zeros((h, w, 4), dtype=np.uint8)
      mask_arr[mask_idxs[1:]] = color
  
      # Now create a second mask and draw the desired color on top of the
      # border mask. If `border_thickness` is 0, this replaces the border mask
      _mask = Image.fromarray(mask_arr)
      _mask = _mask.filter(PIL.ImageFilter.MinFilter(border_thickness))
      _mask_idx = np.where(_mask.convert("L", palette=Image.ADAPTIVE))
      mask_arr[_mask_idx] = np.append(color[:3], blend * 255)
  
      # Create RGBA PIL mask image
      mask_pil = PIL.Image.fromarray(mask_arr, mode="RGBA")
  
      # Blend everything keeping the alpha
      # Key concept is that alpha for non-mask pixels are 0 (transparent)
      img.putalpha(255)
      img = PIL.Image.alpha_composite(img, mask_pil)
      return np.array(img)
  
file_path: icevision/icevision/visualize/draw_data.py
imports: from icevision.imports import *
  from icevision.data import *
  from icevision.core import *
  from icevision.visualize.utils import *
  from matplotlib.colors import LinearSegmentedColormap
  from PIL import Image, ImageFont, ImageDraw
  import PIL
label_desc: Use image node_id 7 for calling a global function with example usage: draw_mask(img, mask, color, blend, border_thickness) and returns: np