def check(self, hostname, key):
k = self.lookup(hostname)<EOL>if k is None:<EOL><INDENT>return False<EOL><DEDENT>host_key = k.get(key.get_name(), None)<EOL>if host_key is None:<EOL><INDENT>return False<EOL><DEDENT>return host_key.asbytes() == key.asbytes()<EOL>
Return True if the given key is associated with the given hostname
in this dictionary.

:param str hostname: hostname (or IP) of the SSH server
:param .PKey key: the key to check
:return:
    ``True`` if the key is associated with the hostname; else ``False``