code: def parse_date(self, date):
          if self.date_format is not None:
              return datetime.datetime.strptime(date, self.date_format).date()
          if re.match('\d{8}$', date):
              return datetime.date(*map(int, (date[:4], date[4:6], date[6:])))
          try:
              parts = date_delim.split(date, 2)
              if len(parts) == 3:
                  if len(parts[0]) == 4:
                      return datetime.date(*map(int, parts))
                  elif len(parts[2]) == 4:
                      return datetime.date(*map(int, reversed(parts)))
          except TypeError, ValueError:
              raise reader.DataError('Bad date format: "{}"'.format(date))