code: def _rbox_to_mask(
      box: np.ndarray, shape: Tuple[int, int]
  ) -> np.ndarray:
      """Converts a rotated bounding box to a boolean mask
  
      Args:
      ----
          box: rotated bounding box of shape (4, 2)
          shape: spatial shapes of the output masks
  
      Returns:
      -------
          the boolean mask of the specified shape
      """
      mask: np.ndarray = np.zeros(shape, dtype=np.uint8)
      # Get absolute coords
      if not np.issubdtype(box.dtype, np.integer):
          abs_box = box.copy()
          abs_box[:, 0] = abs_box[:, 0] * shape[1]
          abs_box[:, 1] = abs_box[:, 1] * shape[0]
          abs_box = abs_box.round().astype(int)
      else:
          abs_box = box
          abs_box[2:] = abs_box[2:] + 1
      cv2.fillPoly(mask, [abs_box - 1], 1.0)  # type: ignore[call-overload]
  
      return mask.astype(bool)
  
imports: from typing import Dict, List, Optional, Tuple
  import cv2
  import numpy
  from scipy.optimize import linear_sum_assignment
  from unidecode import unidecode
label_desc: Use image node_id 6 for calling a global function with example usage: _rbox_to_mask(box, shape) and returns: mask