<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def choose(self, hostport=None, blacklist=None):
 """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. """


        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),
        )