code: def validate(self, *args, **kwargs):
          
          # Schemes validation interface
          if is_scheme(self.validator):
              params = getcallargs(self.function, *args, **kwargs)
              params.update(kwargs)
              validator = self.validator(data=params, request=None)
              if validator.is_valid():
                  return
              raise self.exception(validator.errors)
  
          # Simple validation interface
          if hasattr(self.validator, 'is_valid'):
              validator = self.validator(*args, **kwargs)
              # is valid
              if validator.is_valid():
                  return
              # is invalid
              if hasattr(validator, 'errors'):
                  raise self.exception(validator.errors)
              if hasattr(validator, '_errors'):
                  raise self.exception(validator._errors)
              raise self.exception
  
          validation_result = self.validator(*args, **kwargs)
          # is invalid (validator return error message)
          if isinstance(validation_result, string_types):
              raise self.exception(validation_result)
          # is valid (truely result)
          if validation_result:
              return
          # is invalid (falsy result)
          raise self.exception
docs: Step 4 (6 for invariant). Process contract (validator)