@classmethod<EOL><INDENT>def from_private_key_file(cls, filename, password=None):<DEDENT>
key = cls(filename=filename, password=password)<EOL>return key<EOL>
Create a key object by reading a private key file.  If the private
key is encrypted and ``password`` is not ``None``, the given password
will be used to decrypt the key (otherwise `.PasswordRequiredException`
is thrown).  Through the magic of Python, this factory method will
exist in all subclasses of PKey (such as `.RSAKey` or `.DSSKey`), but
is useless on the abstract PKey class.

:param str filename: name of the file to read
:param str password:
    an optional password to use to decrypt the key file, if it's
    encrypted
:return: a new `.PKey` based on the given private key

:raises: ``IOError`` -- if there was an error reading the file
:raises: `.PasswordRequiredException` -- if the private key file is
    encrypted, and ``password`` is ``None``
:raises: `.SSHException` -- if the key file is invalid