def convert(self, value):
        if isinstance(value, date):
            return value
        value = _to_string(value)
        if not value:
            if self.required:
                message = self.messages['required']
                if message is None:
                    message = self.gettext(u'This field is required.')
                raise ValidationError(message)
            return None
        try:
            return parse_date(value, date_formats=self.date_formats)
        except __HOLE__:
            message = self.messages['invalid_date']
            if message is None:
                message = self.gettext('Please enter a valid date.')
            raise ValidationError(message)
dataset/ETHPy150Open mitsuhiko/fungiform/fungiform/forms.py/DateField.convert