def peer_closed(self, peer: Peer) -> None:
    with self.lock:
        peer2 = self._peers.get(peer.pubkey)
        if (peer2 is peer):
            self._peers.pop(peer.pubkey)
def peer_closed(self, peer: Peer) -> None:
    with self.lock:
        peer2 = self._peers.get(peer.pubkey)
        if (peer2 is peer):
            self._peers.pop(peer.pubkey)