code: def choose(self, hostport=None, blacklist=None):
          
  
          blacklist = blacklist or set()
          if hostport:
              return self._get_isolated(hostport)
  
          return self.peer_heap.smallest_peer(
              (lambda p: p.hostport not in blacklist and not p.is_ephemeral),
          )
docs: Choose a Peer that matches the given criteria.
  
          :param hostport:
              Specifies that the returned Peer must be for the given host-port.
              Without this, all peers managed by this PeerGroup are
              candidates.
          :param blacklist:
              Peers on the blacklist won't be chosen.
          :returns:
              A Peer that matches all the requested criteria or None if no such
              Peer was found.