def METHOD_NAME(node, force=False):
    try:
        # If node is an IP address, find the node name.
        is_node_ip = True
        try:
            ip_address(node)
        except ValueError:
            is_node_ip = False
        if is_node_ip:
            node_info = subprocess.check_output(
                "{}/microk8s-kubectl.wrapper get no -o json".format(snap_path).split()
            )
            info = json.loads(node_info.decode())
            found = False
            for n in info["items"]:
                if found:
                    break
                for a in n["status"]["addresses"]:
                    if a["type"] == "InternalIP" and a["address"] == node:
                        node = n["metadata"]["name"]
                        found = True
                        break
        # Make sure this node exists
        node_info = subprocess.check_output(
            "{}/microk8s-kubectl.wrapper get no {} -o json".format(snap_path, node).split()
        )
        info = json.loads(node_info.decode())
        node_address = None
        for a in info["status"]["addresses"]:
            if a["type"] == "InternalIP":
                node_address = a["address"]
                break
        if not node_address:
            print("Node {} is not part of the cluster.".format(node))
            exit(1)
        node_ep = None
        my_ep, other_ep = get_dqlite_endpoints()
        for ep in other_ep:
            if ep.startswith("{}:".format(node_address)):
                node_ep = ep
        if node_ep and force:
            delete_dqlite_node([node_ep], my_ep)
        elif node_ep and not force:
            print(
                "Removal failed. Node {} is registered with dqlite. "
                "Please, run first 'microk8s leave' on the departing node. \n"
                "If the node is not available anymore and will never attempt to join the cluster "
                "in the future use the '--force' flag \n"
                "to unregister the node while removing it.".format(node)
            )
            exit(1)
    except subprocess.CalledProcessError:
        print("Node {} does not exist in Kubernetes.".format(node))
        if force:
            print("Attempting to remove {} from dqlite.".format(node))
            # Make sure we do not have the node in dqlite.
            # We assume the IP is provided to denote the
            my_ep, other_ep = get_dqlite_endpoints()
            for ep in other_ep:
                if ep.startswith("{}:".format(node)):
                    print("Removing node entry found in dqlite.")
                    delete_dqlite_node([ep], my_ep)
        exit(1)
    remove_node(node)