class_docstr: File handler for MODIS HDF-EOS Level 2 files.
  
  Includes error handling for files produced by IMAPP produced files.
class_docstr_tok: ["File","handler","for","MODIS","HDF-EOS","Level","2","files",".","Includes","error","handling","for","files","produced","by","IMAPP","produced","files","."]
code: def _mask_with_quality_assurance_if_needed(
      self, dataset, dataset_info, dataset_id
  ):
      if not dataset_info.get("quality_assurance", False):
          return dataset
  
      # Get quality assurance dataset recursively
      quality_assurance_dataset_id = dataset_id.from_dict(
          dict(name="quality_assurance", resolution=1000)
      )
      quality_assurance_dataset_info = {
          "name": "quality_assurance",
          "resolution": 1000,
          "byte_dimension": 2,
          "byte": 0,
          "bit_start": 0,
          "bit_count": 1,
          "file_key": "Quality_Assurance",
      }
      quality_assurance = self.get_dataset(
          quality_assurance_dataset_id, quality_assurance_dataset_info
      )
      # Duplicate quality assurance dataset to create relevant filter
      duplication_factor = [
          int(dataset_dim / quality_assurance_dim)
          for dataset_dim, quality_assurance_dim in zip(
              dataset.shape, quality_assurance.shape
          )
      ]
      quality_assurance = np.tile(quality_assurance, duplication_factor)
      # Replace unassured data by NaN value
      dataset = dataset.where(
          quality_assurance != 0, dataset.attrs["_FillValue"]
      )
      return dataset
  
imports: import logging
  import dask.array
  import numpy
  import xarray
  from satpy.readers.hdf4_utils import from_sds
  from satpy.readers.hdfeos_base import HDFEOSGeoReader
  from satpy.utils import get_legacy_chunk_size
label_desc: Use image node_id 9 for calling the ModisL2HDFFileHandler obj's underlying member method code with example usage: obj._mask_with_quality_assurance_if_needed(dataset, dataset_info, dataset_id) and returns: dataset, dataset