code: def _read_with_mask(raster, masked):
          
          if masked is None:
              mask_flags = raster.mask_flag_enums
              per_dataset_mask = all([rasterio.enums.MaskFlags.per_dataset in flags for flags in mask_flags])
              masked = per_dataset_mask
          return masked
docs: returns if we should read from rasterio using the masked