def load(self, filename):
with open(filename, "<STR_LIT:r>") as f:<EOL><INDENT>for lineno, line in enumerate(f, <NUM_LIT:1>):<EOL><INDENT>line = line.strip()<EOL>if (len(line) == <NUM_LIT:0>) or (line[<NUM_LIT:0>] == "<STR_LIT:#>"):<EOL><INDENT>continue<EOL><DEDENT>try:<EOL><INDENT>e = HostKeyEntry.from_line(line, lineno)<EOL><DEDENT>except SSHException:<EOL><INDENT>continue<EOL><DEDENT>if e is not None:<EOL><INDENT>_hostnames = e.hostnames<EOL>for h in _hostnames:<EOL><INDENT>if self.check(h, e.key):<EOL><INDENT>e.hostnames.remove(h)<EOL><DEDENT><DEDENT>if len(e.hostnames):<EOL><INDENT>self._entries.append(e)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Read a file of known SSH host keys, in the format used by OpenSSH.
This type of file unfortunately doesn't exist on Windows, but on
posix, it will usually be stored in
``os.path.expanduser("~/.ssh/known_hosts")``.

If this method is called multiple times, the host keys are merged,
not cleared.  So multiple calls to `load` will just call `add`,
replacing any existing entries and adding new ones.

:param str filename: name of the file to read host keys from

:raises: ``IOError`` -- if there was an error reading the file