code: def lookup(self, hostname):
          
  
          class SubDict(MutableMapping):
              def __init__(self, hostname, entries, hostkeys):
                  self._hostname = hostname
                  self._entries = entries
                  self._hostkeys = hostkeys
  
              def __iter__(self):
                  for k in self.keys():
                      yield k
  
              def __len__(self):
                  return len(self.keys())
  
              def __delitem__(self, key):
                  for e in list(self._entries):
                      if e.key.get_name() == key:
                          self._entries.remove(e)
                  else:
                      raise KeyError(key)
  
              def __getitem__(self, key):
                  for e in self._entries:
                      if e.key.get_name() == key:
                          return e.key
                  raise KeyError(key)
  
              def __setitem__(self, key, val):
                  for e in self._entries:
                      if e.key is None:
                          continue
                      if e.key.get_name() == key:
                          # replace
                          e.key = val
                          break
                  else:
                      # add a new one
                      e = HostKeyEntry([hostname], val)
                      self._entries.append(e)
                      self._hostkeys._entries.append(e)
  
              def keys(self):
                  return [
                      e.key.get_name()
                      for e in self._entries
                      if e.key is not None
                  ]
  
          entries = []
          for e in self._entries:
              if self._hostname_matches(hostname, e):
                  entries.append(e)
          if len(entries) == 0:
              return None
          return SubDict(hostname, entries, self)
docs: Find a hostkey entry for a given hostname or IP.  If no entry is found,
          ``None`` is returned.  Otherwise a dictionary of keytype to key is
          returned.  The keytype will be either ``"ssh-rsa"`` or ``"ssh-dss"``.
  
          :param str hostname: the hostname (or IP) to lookup
          :return: dict of `str` -> `.PKey` keys associated with this host
              (or ``None``)