def _datetime_property(header):
 def getter(self):
  value = self.headers.get(header, None)
  if (value is not None):
   try:
    parts = parsedate(self.headers[header])[:7]
    return datetime(*(parts + (UTC,)))
   except Exception:
    return None
 def setter(self, value):
  if isinstance(value, ((float,) + six.integer_types)):
   self.headers[header] = time.strftime('%a, %d %b %Y %H:%M:%S GMT', time.gmtime(value))
  elif isinstance(value, datetime):
   self.headers[header] = value.strftime('%a, %d %b %Y %H:%M:%S GMT')
  else:
   self.headers[header] = value
 return property(getter, setter, doc=('Retrieve and set the %s header as a datetime, set it with a datetime, int, or str' % header))

def _datetime_property ( header ) : def getter ( self ) : value = self . headers . get ( header , None ) if ( value is not None ) : try : parts = parsedate ( self . headers [ header ] ) [ : 7 ] return datetime ( * ( parts + ( UTC , ) ) ) except Exception : return None def setter ( self , value ) : if isinstance ( value , ( ( float , ) + six . integer_types ) ) : self . headers [ header ] = time . strftime ( '%a, %d %b %Y %H:%M:%S GMT' , time . gmtime ( value ) ) elif isinstance ( value , datetime ) : self . headers [ header ] = value . strftime ( '%a, %d %b %Y %H:%M:%S GMT' ) else : self . headers [ header ] = value return property ( getter , setter , doc = ( 'Retrieve and set the %s header as a datetime, set it with a datetime, int, or str' % header ) )
set and retrieve the datetime value of self .