docs: def _check_flag_values(self, ds, name):
          '''
          Checks a variable's flag_values attribute for compliance under CF
  
          - flag_values exists as an array
          - unique elements in flag_values
          - flag_values si the same dtype as the variable
          - flag_values is the same length as flag_meanings
  
          :param netCDF4.Dataset ds: An open netCDF dataset
          :param str name: Name of variable to check
          :rtype: compliance_checker.base.Result
          '''
          variable = ds.variables[name]
  
          flag_values = variable.flag_values
          flag_meanings = getattr(variable, 'flag_meanings', None)
          valid_values = TestCtx(BaseCheck.HIGH, self.section_titles['3.5'])
  
          # flag_values must be a list of values, not a string or anything else
          valid_values.assert_true(isinstance(flag_values, np.ndarray),
                                   "{}'s flag_values must be an array of values not {}".format(name, type(flag_values)))
  
          # We can't perform any more checks
          if not isinstance(flag_values, np.ndarray):
              return valid_values.to_result()
  
          # the flag values must be independent, no repeating values
          flag_set = set(flag_values)
          valid_values.assert_true(len(flag_set) == len(flag_values),
                                   "{}'s flag_values must be independent and can not be repeated".format(name))
  
          # the data type for flag_values should be the same as the variable
          valid_values.assert_true(variable.dtype.type == flag_values.dtype.type,
                                   "flag_values ({}) must be the same data type as {} ({})"
                                   "".format(flag_values.dtype.type, name, variable.dtype.type))
  
          if isinstance(flag_meanings, basestring):
              flag_meanings = flag_meanings.split()
              valid_values.assert_true(len(flag_meanings) == len(flag_values),
                                       "{}'s flag_meanings and flag_values should have the same number ".format(name)+\
                                       "of elements.")
  
          return valid_values.to_result()