def clean(self, text, guess=True, format=None, **kwargs):
        """The classic: date parsing, every which way."""
        # handle date/datetime before converting to text.
        date = self._clean_datetime(text)
        if date is not None:
            return date

        text = stringify(text)
        if text is None:
            return

        if format is not None:
            # parse with a specified format
            try:
                obj = datetime.strptime(text, format)
                return obj.date().isoformat()
            except Exception:
                return None

        if guess and not self.validate(text):
            # use dateparser to guess the format
            obj = self.fuzzy_date_parser(text)
            if obj is not None:
                return obj.date().isoformat()

        return self._clean_text(text)
def clean ( self , text , guess = True , format = None , ** kwargs ) : date = self . _clean_datetime ( text ) if date is not None : return date text = stringify ( text ) if text is None : return if format is not None : try : obj = datetime . strptime ( text , format ) return obj . date ( ) . isoformat ( ) except Exception : return None if guess and not self . validate ( text ) : obj = self . fuzzy_date_parser ( text ) if obj is not None : return obj . date ( ) . isoformat ( ) return self . _clean_text ( text )
The classic: date parsing, every which way.