code: def lookup(self, hostname):
          
          matches = [
              config
              for config in self._config
              if self._allowed(config["host"], hostname)
          ]
  
          ret = SSHConfigDict()
          for match in matches:
              for key, value in match["config"].items():
                  if key not in ret:
                      # Create a copy of the original value,
                      # else it will reference the original list
                      # in self._config and update that value too
                      # when the extend() is being called.
                      ret[key] = value[:] if value is not None else value
                  elif key == "identityfile":
                      ret[key].extend(value)
          ret = self._expand_variables(ret, hostname)
          # TODO: remove in 3.x re #670
          if "proxycommand" in ret and ret["proxycommand"] is None:
              del ret["proxycommand"]
          return ret
docs: 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.