#NEWLINE# def rfc3339_date( date ) : #NEWLINE# #INDENT# date = datetime_safe . new_datetime ( date ) #NEWLINE# time_str = date . strftime ( '%Y-%m-%dT%H:%M:%S' ) #NEWLINE# if ( not six . PY3 ) : #NEWLINE# #INDENT# time_str = time_str . decode ( 'utf-8' ) #NEWLINE# #UNINDENT# if is_aware ( date ) : #NEWLINE# #INDENT# offset = date . tzinfo . utcoffset ( date ) #NEWLINE# timezone = ( ( ( offset . days * 24 ) * 60 ) + ( offset . seconds // 60 ) ) #NEWLINE# ( hour , minute ) = divmod ( offset , 60 ) #NEWLINE# return ( time_str + ( '%+03d:%02d' % ( hour , minute ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( time_str + 'Z' )