code: def _mask_or_not(out, src, fill_value):
      if isinstance(src, np.ma.MaskedArray):
          if not isinstance(out, np.ma.MaskedArray):
              if np.isfinite(fill_value):
                  masked = np.ma.masked_equal(
                      out, fill_value, copy=False
                  )
              else:
                  masked = np.ma.masked_invalid(out, copy=False)
              masked.set_fill_value(fill_value)
              return masked
      return out
  
imports: from __future__ import annotations
  from itertools import groupby
  from math import floor, ceil
  import dask.array
  import numpy
  from dask.delayed import delayed
  from numba import prange
  from .utils import ngjit, ngjit_parallel
label_desc: Use image node_id 9 for calling a global function with example usage: _mask_or_not(out, src, fill_value) and returns: out, masked