def lookup(self, hostname):
matches = [<EOL>config<EOL>for config in self._config<EOL>if self._allowed(config["<STR_LIT:host>"], hostname)<EOL>]<EOL>ret = SSHConfigDict()<EOL>for match in matches:<EOL><INDENT>for key, value in match["<STR_LIT>"].items():<EOL><INDENT>if key not in ret:<EOL><INDENT>ret[key] = value[:] if value is not None else value<EOL><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>ret[key].extend(value)<EOL><DEDENT><DEDENT><DEDENT>ret = self._expand_variables(ret, hostname)<EOL>if "<STR_LIT>" in ret and ret["<STR_LIT>"] is None:<EOL><INDENT>del ret["<STR_LIT>"]<EOL><DEDENT>return ret<EOL>
Return a dict (`SSHConfigDict`) of config options for a given hostname.

The host-matching rules of OpenSSH's ``ssh_config`` man page are used:
For each parameter, the first obtained value will be used.  The
configuration files contain sections separated by ``Host``
specifications, and that section is only applied for hosts that match
one of the patterns given in the specification.

Since the first obtained value for each parameter is used, more host-
specific declarations should be given near the beginning of the file,
and general defaults at the end.

The keys in the returned dict are all normalized to lowercase (look for
``"port"``, not ``"Port"``. The values are processed according to the
rules for substitution variable expansion in ``ssh_config``.

Finally, please see the docs for `SSHConfigDict` for deeper info on
features such as optional type conversion methods, e.g.::

    conf = my_config.lookup('myhost')
    assert conf['passwordauthentication'] == 'yes'
    assert conf.as_bool('passwordauthentication') is True

:param str hostname: the hostname to lookup

.. versionchanged:: 2.5
    Returns `SSHConfigDict` objects instead of dict literals.