'Validates that the value is in self.choices and can be coerced to the
right type.'

def to_python(self, value):

    value = super(TypedChoiceField, self).to_python(value)
    super(TypedChoiceField, self).validate(value)
    if ((value == self.empty_value) or (value in validators.EMPTY_VALUES)):
        return self.empty_value
    try:
        value = self.coerce(value)
    except (ValueError, TypeError, ValidationError):
        raise ValidationError((self.error_messages[u'invalid_choice'] % {u'value': value}))
    return value
