code: def encode_bool_mask(self, bool_mask):
      _mask = bool_mask
      if use_rle:
          _mask = mask_utils.encode(
              np.asfortranarray(bool_mask.astype(np.uint8))
          )
      return _mask
  
imports: import copy
  from typing import Dict, List, Optional
  import numpy
  from sahi.utils.coco import CocoAnnotation, CocoPrediction
  from sahi.utils.cv import get_bbox_from_bool_mask, get_bool_mask_from_coco_segmentation, get_coco_segmentation_from_bool_mask
  from sahi.utils.shapely import ShapelyAnnotation
label_desc: Use image node_id 4 for calling the Mask obj's underlying member method code with example usage: obj.encode_bool_mask(bool_mask) and returns: _mask