#NEWLINE# def update_luids( obj ) : #NEWLINE# #INDENT# "Update local UIDs on `obj'. NOTE: updates the object in-place!" #NEWLINE# if isinstance ( obj , dict ) : #NEWLINE# #INDENT# for key in obj : #NEWLINE# #INDENT# value = obj [ key ] #NEWLINE# if ( key == 'id' ) : #NEWLINE# #INDENT# obj [ 'id' ] = random_luid ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( value , dict ) or isinstance ( value , list ) ) : #NEWLINE# #INDENT# update_luids ( value ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( obj , list ) : #NEWLINE# #INDENT# for elem in obj : #NEWLINE# #INDENT# update_luids ( elem ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return obj