'Close one or all broker connections.
Arguments:
node_id (int, optional): the id of the node to close'

def close(self, node_id=None):

    if (node_id is None):
        self._closed = True
        for conn in self._conns.values():
            conn.close()
        self._wake_r.close()
        self._wake_w.close()
        self._selector.close()
    elif (node_id in self._conns):
        self._conns[node_id].close()
    else:
        log.warning('Node    %s    not    found    in    current    connection    list;    skipping', node_id)
        return
