def ValidateDate(self, date, field_name, problems, context=None):
    if date is None:
      # No exception is issued because ServicePeriods can be created using only
      # calendar_dates.txt. In that case we have a ServicePeriod consisting
      # entirely of service exceptions, and with no start_date or end_date.
      return False
    if util.IsEmpty(date):
      problems.MissingValue(field_name, date, context)
      return False
    elif not util.ValidateDate(date, field_name, problems):
      return False
    else:
      try:
        date_value = time.strptime(date, "%Y%m%d")
        if not (self._VALID_DATE_RANGE_FROM <= date_value.tm_year <=
                self._VALID_DATE_RANGE_TO):
          problems.DateOutsideValidRange(field_name, date,
                                         self._VALID_DATE_RANGE_FROM,
                                         self._VALID_DATE_RANGE_TO,
                                         context=context)
          return False
        return True
      except __HOLE__:
        problems.InvalidValue(field_name, 'Could not parse date value.',
                              date, context, problems_module.TYPE_ERROR)
        return False
dataset/ETHPy150Open google/transitfeed/transitfeed/serviceperiod.py/ServicePeriod.ValidateDate