def parse_http_date(date):
 for regex in (RFC1123_DATE, RFC850_DATE, ASCTIME_DATE):
  m = regex.match(date)
  if (m is not None):
   break
 else:
  raise ValueError((u'%r is not in a valid HTTP date format' % date))
 try:
  year = int(m.group(u'year'))
  if (year < 100):
   if (year < 70):
    year += 2000
   else:
    year += 1900
  month = (MONTHS.index(m.group(u'mon').lower()) + 1)
  day = int(m.group(u'day'))
  hour = int(m.group(u'hour'))
  min = int(m.group(u'min'))
  sec = int(m.group(u'sec'))
  result = datetime.datetime(year, month, day, hour, min, sec)
  return calendar.timegm(result.utctimetuple())
 except Exception:
  six.reraise(ValueError, ValueError((u'%r is not a valid date' % date)), sys.exc_info()[2])

def parse_http_date ( date ) : for regex in ( RFC1123_DATE , RFC850_DATE , ASCTIME_DATE ) : m = regex . match ( date ) if ( m is not None ) : break else : raise ValueError ( ( u'%r is not in a valid HTTP date format' % date ) ) try : year = int ( m . group ( u'year' ) ) if ( year < 100 ) : if ( year < 70 ) : year += 2000 else : year += 1900 month = ( MONTHS . index ( m . group ( u'mon' ) . lower ( ) ) + 1 ) day = int ( m . group ( u'day' ) ) hour = int ( m . group ( u'hour' ) ) min = int ( m . group ( u'min' ) ) sec = int ( m . group ( u'sec' ) ) result = datetime . datetime ( year , month , day , hour , min , sec ) return calendar . timegm ( result . utctimetuple ( ) ) except Exception : six . reraise ( ValueError , ValueError ( ( u'%r is not a valid date' % date ) ) , sys . exc_info ( ) [ 2 ] )
parses a date format as specified by http rfc2616 section 3 .