code: def _mask_data_with_quality_flag(datasets_loaded, dataset_keys):
      LOG.debug("Filtering data based on quality flags")
      for ds_id in sorted(dataset_keys):
          ds = datasets_loaded[ds_id]
          quality_flag = [
              x
              for x in ds.attrs.get("ancillary_variables", [])
              if x.attrs.get("name") == "Quality_Flag"
          ]
          if not quality_flag:
              continue
  
          quality_flag = quality_flag[0]
          if quality_flag.dims[0] not in ds.dims:
              continue
          LOG.debug(
              "Masking %s where quality flag doesn't equal 1", ds_id
          )
          datasets_loaded[ds_id] = ds.where(quality_flag == 0)
  
imports: import logging
  from collections import defaultdict
  import numpy
  import pandas
  import xarray
  from satpy.readers.netcdf_utils import NetCDF4FileHandler
  from satpy.readers.yaml_reader import FileYAMLReader
label_desc: Use image node_id 4 for calling a global function with example usage: _mask_data_with_quality_flag(datasets_loaded, dataset_keys) without return types