#NEWLINE# def encode( self , value ) : #NEWLINE# #INDENT# if ( not isinstance ( value , datetime . datetime ) ) : #NEWLINE# #INDENT# raise TypeError ( ( 'expected a datetime.datetime, not ' + repr ( value ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( value . tzinfo is None ) : #NEWLINE# #INDENT# raise ValueError ( 'datetime.datetime must be aware of tzinfo' ) #NEWLINE# #UNINDENT# #UNINDENT# encoded = super ( TZDateTime , self ) . encode ( value . astimezone ( UTC ) ) #NEWLINE# return ( value + b'Z' )