#NEWLINE# def _build_date_header_string( self , date_value ) : #NEWLINE# #INDENT# 'Gets the date_value (may be None, basestring, float or\n\t\tdatetime.datetime instance) and returns a valid date string as per\n\t\tRFC 2822.' #NEWLINE# if isinstance ( date_value , datetime ) : #NEWLINE# #INDENT# date_value = time . mktime ( date_value . timetuple ( ) ) #NEWLINE# #UNINDENT# if ( not isinstance ( self , basestring ) ) : #NEWLINE# #INDENT# date_value = formatdate ( date_value , localtime = True ) #NEWLINE# #UNINDENT# return native ( date_value )