code: def extract_date(cls, date_str):
          
          if not date_str:
              raise DateTimeFormatterException('date_str must a valid string {}.'.format(date_str))
  
          try:
              return cls._extract_timestamp(date_str, cls.DATE_FORMAT)
          except (TypeError, ValueError):
              raise DateTimeFormatterException('Invalid date string {}.'.format(date_str))
docs: Tries to extract a `datetime` object from the given string, expecting
          date information only.
  
          Raises `DateTimeFormatterException` if the extraction fails.