#NEWLINE# def _ValidateOneContact( self , user_id , identities_properties , contact_source , name , given_name , family_name , rank = None ) : #NEWLINE# #INDENT# 'Validates that the specified contact has been created, and any previous contacts with\n    same identity have been deleted. Returns the contact that should exist.\n    ' #NEWLINE# contact_dict = Contact . CreateContactDict ( user_id , identities_properties , util . _TEST_TIME , contact_source , name = name , given_name = given_name , family_name = family_name , rank = rank ) #NEWLINE# predicate = ( lambda contact : ( contact_dict [ 'contact_id' ] == contact . contact_id ) ) #NEWLINE# old_contacts = self . _validator . QueryModelObjects ( Contact , predicate = predicate ) #NEWLINE# if ( ( len ( old_contacts ) == 0 ) or old_contacts [ 0 ] . IsRemoved ( ) ) : #NEWLINE# #INDENT# if ( len ( old_contacts ) > 0 ) : #NEWLINE# #INDENT# self . _validator . ValidateDeleteDBObject ( Contact , old_contacts [ 0 ] . GetKey ( ) ) #NEWLINE# #UNINDENT# contact_dict = Contact . CreateContactDict ( ** contact_source ) #NEWLINE# return self . _validator . ValidateCreateDBObject ( Contact , ** contact_dict ) #NEWLINE# #UNINDENT# return old_contacts [ 0 ]