def _read_private_key_file(self, tag, filename, password=None):
f = open(filename, '<STR_LIT:r>')<EOL>data = self._read_private_key(tag, f, password)<EOL>f.close()<EOL>return data<EOL>
Read an SSH2-format private key file, looking for a string of the type
C{"BEGIN xxx PRIVATE KEY"} for some C{xxx}, base64-decode the text we
find, and return it as a string.  If the private key is encrypted and
C{password} is not C{None}, the given password will be used to decrypt
the key (otherwise L{PasswordRequiredException} is thrown).

@param tag: C{"RSA"} or C{"DSA"}, the tag used to mark the data block.
@type tag: str
@param filename: name of the file to read.
@type filename: str
@param password: an optional password to use to decrypt the key file,
    if it's encrypted.
@type password: str
@return: data blob that makes up the private key.
@rtype: str

@raise IOError: if there was an error reading the file.
@raise PasswordRequiredException: if the private key file is
    encrypted, and C{password} is C{None}.
@raise SSHException: if the key file is invalid.