#NEWLINE# def _validate_optional_links( self , expected , links ) : #NEWLINE# #INDENT# for ( uri , l ) in links . items ( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# rel = l [ 'rel' ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise exception . OCCIMissingType ( type_id = uri ) #NEWLINE# #UNINDENT# for ex in expected : #NEWLINE# #INDENT# if ( rel == ex . type_id ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# expected_types = ', ' . join ( [ e . type_id for e in links ] ) #NEWLINE# raise exception . OCCISchemaMismatch ( expected = expected_types , found = l [ 'rel' ] )