Returns the connection id associated with a publically
        reachable endpoint or raises KeyError if the endpoint is not
        found.

        Args:
            endpoint (str): A zmq-style uri which identifies a publically
                reachable endpoint.

def get_connection_id_by_endpoint(self, endpoint):
        """Returns the connection id associated with a publically
        reachable endpoint or raises KeyError if the endpoint is not
        found.

        Args:
            endpoint (str): A zmq-style uri which identifies a publically
                reachable endpoint.
        """
        with self._connections_lock:
            for connection_id in self._connections:
                connection_info = self._connections[connection_id]
                if connection_info.uri == endpoint:
                    return connection_id
            raise KeyError()