<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_valid(self, model, validator=None):
 """Returns true if the model passes the validation, and false if not. Validator must be present_optional if validation is not 'simple'. """

    if self.property_name and self.is_property_specific:
      arg0 = getattr(model, self.property_name)
    else:
      arg0 = model

    if self.is_simple:
      is_valid = self.callback(arg0)
    else:
      is_valid = self.callback(arg0, validator)

    return (is_valid, None if is_valid else (self.message or "is invalid"))