def save(self, filename):
with open(filename, "<STR_LIT:w>") as f:<EOL><INDENT>for e in self._entries:<EOL><INDENT>line = e.to_line()<EOL>if line:<EOL><INDENT>f.write(line)<EOL><DEDENT><DEDENT><DEDENT>
Save host keys into a file, in the format used by OpenSSH.  The order
of keys in the file will be preserved when possible (if these keys were
loaded from a file originally).  The single exception is that combined
lines will be split into individual key lines, which is arguably a bug.

:param str filename: name of the file to write

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

.. versionadded:: 1.6.1