docs: def _check_flag_masks(self, ds, name):
          '''
          Check a variable's flag_masks attribute for compliance under CF
  
          - flag_masks exists as an array
          - flag_masks is the same dtype as the variable
          - variable's dtype can support bit-field
          - flag_masks is the same length as flag_meanings
  
          :param netCDF4.Dataset ds: An open netCDF dataset
          :param str name: Variable name
          :rtype: compliance_checker.base.Result
          '''
          variable = ds.variables[name]
  
          flag_masks = variable.flag_masks
          flag_meanings = getattr(ds, 'flag_meanings', None)
  
          valid_masks = TestCtx(BaseCheck.HIGH, self.section_titles['3.5'])
  
          valid_masks.assert_true(isinstance(flag_masks, np.ndarray),
                                  "{}'s flag_masks must be an array of values not {}".format(name, type(flag_masks)))
  
          if not isinstance(flag_masks, np.ndarray):
              return valid_masks.to_result()
  
          valid_masks.assert_true(variable.dtype.type == flag_masks.dtype.type,
                                  "flag_masks ({}) mustbe the same data type as {} ({})"
                                  "".format(flag_masks.dtype.type, name, variable.dtype.type))
  
          type_ok = (np.issubdtype(variable.dtype, np.integer) or
                     np.issubdtype(variable.dtype, 'S') or
                     np.issubdtype(variable.dtype, 'b'))
  
          valid_masks.assert_true(type_ok, "{}'s data type must be capable of bit-field expression".format(name))
  
          if isinstance(flag_meanings, basestring):
              flag_meanings = flag_meanings.split()
              valid_masks.assert_true(len(flag_meanings) == len(flag_masks),
                                      "{} flag_meanings and flag_masks should have the same number ".format(name)+\
                                      "of elements.")
  
          return valid_masks.to_result()