def METHOD_NAME(upgrade, phase, node_ep, token):
    """
    Upgrade a node
    :param upgrade: which upgrade to call
    :param phase: prepare, commit or rollback
    :param node_ep: the node endpoint the nodes cluster agent listens at
    :param token: the callback token to access the node
    :return:
    """
    try:
        upgrade_script = "{}/upgrade-scripts/{}/{}-node.sh".format(snap_path, upgrade, phase)
        if os.path.isfile(upgrade_script):
            remote_op = {"callback": token, "phase": phase, "upgrade": upgrade}
            # TODO: handle ssl verification
            res = requests.post(
                "https://{}/{}/upgrade".format(node_ep, CLUSTER_API), json=remote_op, verify=False
            )
            if res.status_code != 200:
                print("Failed to perform a {} on node {}".format(remote_op["upgrade"], node_ep))
                raise Exception("Failed to {} on {}".format(phase, node_ep))
    except subprocess.CalledProcessError as e:
        print("{} upgrade step failed on {}".format(phase, node_ep))
        raise e