def traffic_control_restore(device):
    cmd = ["tc", "qdisc", "del", "dev", device, "root"]

    p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE)
    _, stderr = p.communicate()
    stderr = stderr.decode()

    if p.returncode != 0:
        if p.returncode == 2 and stderr:
            if "No such file or directory" in stderr:
                return

        # TODO log error somewhere?
        raise BlockadeError("Problem calling traffic control: " +
                            " ".join(cmd))
dataset/ETHPy150Open dcm-oss/blockade/blockade/net.py/traffic_control_restore/original