def remove_node(self, node, stop=False):
        """Removes a node from the cluster.

        By default, it doesn't also stop the node, just remove from
        the known hosts of this cluster.

        :param node: node to remove
        :type node: :py:class:`Node`

        :param stop: Stop the node
        :type stop: bool

        """
        if node.kind not in self.nodes:
            raise NodeNotFound("Unable to remove node %s: invalid node type `%s`.",
                               node.name, node.kind)
        else:
            try:
                index = self.nodes[node.kind].index(node)
                if self.nodes[node.kind][index]:
                    del self.nodes[node.kind][index]
                if stop:
                    node.stop()
                self._naming_policy.free(node.kind, node.name)
                self.repository.save_or_update(self)
                remaining_nodes = self.get_all_nodes()
                self._gather_node_ip_addresses(
                    remaining_nodes, self.start_timeout, self.ssh_probe_timeout,
                    remake=True)
            except ValueError:
                raise NodeNotFound("Node %s not found in cluster" % node.name)
Removes a node from the cluster.

        By default, it doesn't also stop the node, just remove from
        the known hosts of this cluster.

        :param node: node to remove
        :type node: :py:class:`Node`

        :param stop: Stop the node
        :type stop: bool