def validate(self, model, validator=None):
    """Checks the model against all filters, and if it shoud be validated, runs the validation. if
    the model is invalid, an error is added to the model. Then the validity value is returned.
    """
    for filter_ in self.filters:
      if not filter_(model):
        return True

    is_valid, message = self.is_valid(model, validator)
    if not is_valid:
      model.add_error(self.pretty_property_name or self.property_name, message)
    return is_valid
Checks the model against all filters, and if it shoud be validated, runs the validation. if
    the model is invalid, an error is added to the model. Then the validity value is returned.