#NEWLINE# def default( self , obj , **kwargs ) : #NEWLINE# #INDENT# if isinstance ( obj , datetime . datetime ) : #NEWLINE# #INDENT# if ( obj . tzinfo is None ) : #NEWLINE# #INDENT# raise TypeError ( ( "date '%s' is not fully timezone qualified." % obj ) ) #NEWLINE# #UNINDENT# obj = obj . astimezone ( pytz . UTC ) #NEWLINE# return '{}' . format ( obj . isoformat ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( obj , datetime . date ) : #NEWLINE# #INDENT# return '{}' . format ( obj . isoformat ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# return super ( JSONEncoderPlus , self ) . default ( obj , ** kwargs )