code: def remove_node(self, node, stop=False):
          
          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)
              except ValueError:
                  raise NodeNotFound("Node %s not found in cluster" % node.name)
docs: 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