def Validate(self):
    """Validates all parameters of the request.


    This method returns L{None} if the validation succeeds, or raises
    an exception otherwise.

    @rtype: NoneType
    @return: L{None}, if the validation succeeds

    @raise Exception: validation fails

    """
    assert constants.VALID_IALLOCATOR_MODES in self.MODE

    for (param, validator) in self.REQ_PARAMS:
      if not hasattr(self, param):
        raise errors.OpPrereqError("Request is missing '%s' parameter" % param,
                                   errors.ECODE_INVAL)

      value = getattr(self, param)
      if not validator(value):
        raise errors.OpPrereqError(("Request parameter '%s' has invalid"
                                    " type %s/value %s") %
                                    (param, type(value), value),
                                    errors.ECODE_INVAL)
dataset/ETHPy150Open ganeti/ganeti/lib/masterd/iallocator.py/IARequestBase.Validate/swapped operands of `in`