code: def mask_image_data(data):
      
      if data.bands.size in (2, 4):
          if not np.issubdtype(data.dtype, np.integer):
              raise ValueError("Only integer datatypes can be used as a mask.")
          mask = data.data[-1, :, :] == np.iinfo(data.dtype).min
          data = data.astype(np.float64)
          masked_data = da.stack([da.where(mask, np.nan, data.data[i, :, :])
                                  for i in range(data.shape[0])])
          data.data = masked_data
          data = data.sel(bands=BANDS[data.bands.size - 1])
      return data
docs: Mask image data if alpha channel is present.