docs: def _check_valid_cf_units(self, ds, variable_name):
          '''
          Checks that the variable contains units attribute, the attribute is a
          string and the value is not deprecated by CF
  
          :param netCDF4.Dataset ds: An open netCDF dataset
          :param str variable_name: Name of the variable to be checked
          :rtype:
          :return: List of results
          '''
  
          # This list is straight from section 3
          deprecated = ['level', 'layer', 'sigma_level']
          variable = ds.variables[variable_name]
  
          units = getattr(variable, 'units', None)
          standard_name_full = getattr(variable, 'standard_name', None)
          standard_name, standard_name_modifier = self._split_standard_name(standard_name_full)
          std_name_units_dimensionless = cfutil.is_dimensionless_standard_name(self._std_names._root,
                                                                 standard_name)
          # Is this even in the database? also, if there is no standard_name,
          # there's no way to know if it is dimensionless.
          should_be_dimensionless = (variable.dtype.char == 'S' or
                                     std_name_units_dimensionless or
                                     standard_name is None)
  
          # 1) Units must exist
          valid_units = TestCtx(BaseCheck.HIGH, self.section_titles['3.1'])
          valid_units.assert_true(should_be_dimensionless or units is not None,
                                  'units attribute is required for {} when variable is not a dimensionless quantity'.format(variable_name))
  
          # Don't bother checking the rest
          if units is None and not should_be_dimensionless:
              return valid_units.to_result()
          # 2) units attribute must be a string
          valid_units.assert_true(should_be_dimensionless or isinstance(units, basestring),
                                  'units attribute for {} needs to be a string'.format(variable_name))
  
          # 3) units are not deprecated
          valid_units.assert_true(units not in deprecated,
                                  'units for {}, "{}" are deprecated by CF 1.6'.format(variable_name, units))
  
          return valid_units.to_result()