#NEWLINE# def encode( self , obj , * args , **kwargs ) : #NEWLINE# #INDENT# if isinstance ( obj , dict ) : #NEWLINE# #INDENT# new_obj = type ( obj ) ( ) #NEWLINE# for ( key , value ) in six . iteritems ( obj ) : #NEWLINE# #INDENT# if is_lazy_string ( key ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# key = unicode ( key ) #NEWLINE# #UNINDENT# except NameError : #NEWLINE# #INDENT# key = str ( key ) #NEWLINE# #UNINDENT# #UNINDENT# new_obj [ key ] = value #NEWLINE# #UNINDENT# obj = new_obj #NEWLINE# #UNINDENT# return super ( JSONEncoder , self ) . encode ( obj , * args , ** kwargs )