'Assert that provided value is compatible with this property.
Args:
value: Value to validate against this Property.
Returns:
A valid value, either the input unchanged or adapted to the
required type.
Raises:
BadValueError if the value is not appropriate for this
property in any way.'

def validate(self, value):

    if self.empty(value):
        if self.required:
            raise BadValueError(('Property    %s    is    required' % self.name))
    elif self.choices:
        if (value not in self.choices):
            raise BadValueError(('Property    %s    is    %r;    must    be    one    of    %r' % (self.name, value, self.choices)))
    if (self.validator is not None):
        self.validator(value)
    return value
