def node_validate(node_dict, node_num, cmd_name):
    """Validate that command can be performed on target node."""
    # cmd: [required-state, action-to-displayed, error-statement]
    req_lu = {"run": ["stopped", "Already Running"],
              "stop": ["running", "Already Stopped"],
              "connect": ["running", "Can't Connect, Node Not Running"],
              "details": [node_dict[node_num].state, ""]}
    tm = {True: ("Node {1}{2}{0} ({5}{3}{0} on {1}{4}{0})".
                 format(C_NORM, C_WARN, node_num,
                        node_dict[node_num].name,
                        node_dict[node_num].cloud_disp, C_TI)),
          False: req_lu[cmd_name][1]}
    node_valid = bool(req_lu[cmd_name][0] == node_dict[node_num].state)
    node_info = tm[node_valid]
    return node_valid, node_info
Validate that command can be performed on target node.