Using Paramiko
Paramiko is a pure-Python (3.6+) implementation of the SSHv2 protocol, providing both client and server functionality.
You may not need every feature Paramiko is providing, but based on their documentation, this module could do just what you need: paramiko.config.SSHConfig
Representation of config information as stored in the format used by OpenSSH. Queries can be made via lookup. The format is described in OpenSSH’s ssh_config man page. This class is provided primarily as a convenience to posix users (since the OpenSSH format is a de-facto standard on posix) but should work fine on Windows too.
You can define a non-standard config-file,the same way you would specify an alternate ssh-config file to ssh command line, as mentioned in a previous answer:
config = SSHConfig.from_file(open("some-path.config"))
# Or more directly:
config = SSHConfig.from_path("some-path.config")
# Or if you have arbitrary ssh_config text from some other source:
config = SSHConfig.from_text("Host foo\n\tUser bar")
You can then retrieve whichever configuration you need like so
For example with a configuration file like this:
Host foo.example.com
PasswordAuthentication no
Compression yes
ServerAliveInterval 60
You could access different settings using:
my_config = SSHConfig()
my_config.parse(open('~/.ssh/config'))
conf = my_config.lookup('foo.example.com')
assert conf['passwordauthentication'] == 'no'
assert conf.as_bool('passwordauthentication') is False
assert conf['compression'] == 'yes'
assert conf.as_bool('compression') is True
assert conf['serveraliveinterval'] == '60'
assert conf.as_int('serveraliveinterval') == 60
In case you only need available hostnames, you can list all available ones, and then get information about their configuration using that context (More info here)
get_hostnames()
Return the set of literal hostnames defined in the SSH config (both explicit hostnames and wildcard entries).
This might not be compliant with your request for a standard library, though the project seems to be actively maintained and widely used as well