def __validate(self, value, validate_element):
    if not self.repeated:
      validate_element(value)
    else:
      # Must be a list or tuple, may not be a string.
      if isinstance(value, (list, tuple)):
        for element in value:
          if element is None:
            try:
              name = self.name
            except AttributeError:
              raise ValidationError('Repeated values for %s '
                                    'may not be None' % self.__class__.__name__)
            else:
              raise ValidationError('Repeated values for field %s '
                                    'may not be None' % name)
          validate_element(element)
      elif value is not None:
        try:
          name = self.name
        except AttributeError:
          raise ValidationError('%s is repeated. Found: %s' % (
            self.__class__.__name__, value))
        else:
          raise ValidationError('Field %s is repeated. Found: %s' % (name,
                                                                     value))
Tests that a SaltCloudSystemExit is raised when something other than
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/protorpc/protorpc/messages.py/Field.__validate--crossover with--dataset/ETHPy150Open saltstack/salt/tests/unit/cloud/clouds/opennebula_test.py/OpenNebulaTestCase.test_vm_allocate_function_error