<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def key(self, identifier=None, security_level=None):
 """ Tries to find an encryption key, first using the ``identifier`` and if that fails or isn't provided using the ``security_level``. Returns ``None`` if nothing matches. """

        if identifier:
            try:
                return self._encryption_keys[identifier]
            except KeyError:
                pass
        if security_level:
            for key in self._encryption_keys.values():
                if key.level == security_level:
                    return key