def run_cmd(cmd, attempts=1):
    """ Runs a command attempts times, logging its output. Returns True if it
    succeeds once, or False if it never does. """
    try:
        for i in range(attempts):
            proc = subprocess.Popen(cmd, stdin=open(devnull, "r"))
            proc.wait()
            if not proc.returncode == 0:
                print("Command ", str(cmd), " failed")
            else:
                print("Command ", str(cmd), " succeeded.")
                return True
            sleep(3)
        return False
    except __HOLE__ as e:
        print("Error while attempting to run command ", cmd)
        print(e)
dataset/ETHPy150Open CiscoCloud/mantl/testing/build-cluster.py/run_cmd