code: def rle_encode(mask: np.ndarray):
      """
      Convert mask to EncodedPixels in run-length encoding
      from https://www.kaggle.com/stainsby/fast-tested-rle-and-input-routines
      """
      pixels = mask.T.flatten()
      # We need to allow for cases where there is a '1' at either end of the sequence.
      # We do this by padding with a zero at each end when needed.
      use_padding = False
      if pixels[0] or pixels[-1]:
          use_padding = True
          pixel_padded = np.zeros([len(pixels) + 2], dtype=pixels.dtype)
          pixel_padded[1:-1] = pixels
          pixels = pixel_padded
      rle = np.where(pixels[1:] != pixels[:-1])[0] + 2
      if use_padding:
          rle = rle - 1
      rle[1::2] = rle[1::2] - rle[:-1:2]
      return rle
  
label_desc: Use image node_id 1 for calling a global function with example usage: rle_encode(mask) and returns: rle