def lookup(self, hostname):
matches = [x for x in self._config if fnmatch.fnmatch(hostname, x['<STR_LIT:host>'])]<EOL>_star = matches.pop(<NUM_LIT:0>)<EOL>matches.append(_star)<EOL>ret = {}<EOL>for m in matches:<EOL><INDENT>for k,v in m.iteritems():<EOL><INDENT>if not k in ret:<EOL><INDENT>ret[k] = v<EOL><DEDENT><DEDENT><DEDENT>ret = self._expand_variables(ret, hostname)<EOL>del ret['<STR_LIT:host>']<EOL>return ret<EOL>
Return a dict of config options for a given hostname.

The host-matching rules of OpenSSH's C{ssh_config} man page are used,
which means that all configuration options from matching host
specifications are merged, with more specific hostmasks taking
precedence. In other words, if C{"Port"} is set under C{"Host *"}
and also C{"Host *.example.com"}, and the lookup is for
C{"ssh.example.com"}, then the port entry for C{"Host *.example.com"}
will win out.

The keys in the returned dict are all normalized to lowercase (look for
C{"port"}, not C{"Port"}. No other processing is done to the keys or
values.

@param hostname: the hostname to lookup
@type hostname: str