code: def with_validator(self, validator):
      
      if not callable(validator):
        raise ValueError('Validator must be callable', validator)
      self.validators.append(validator)
      self._cached = None
      return self
docs: Add a validator callback to this Measurement, chainable.