#NEWLINE# def key( self , identifier = None , security_level = None ) : #NEWLINE# #INDENT# "\n        Tries to find an encryption key, first using the ``identifier`` and\n        if that fails or isn't provided using the ``security_level``.\n        Returns ``None`` if nothing matches.\n        " #NEWLINE# if identifier : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return self . _encryption_keys [ identifier ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# if security_level : #NEWLINE# #INDENT# for key in self . _encryption_keys . values ( ) : #NEWLINE# #INDENT# if ( self . level == security_level ) : #NEWLINE# #INDENT# return key