def _delete_rules(self, ipfw_list=None):
    if ipfw_list is None:
      ipfw_list = platformsettings.ipfw('list')
    existing_rules = set(
        r.split()[0].lstrip('0') for r in ipfw_list.splitlines())
    delete_rules = [r for r in (self._DOWNLOAD_RULE, self._UPLOAD_RULE)
                    if r in existing_rules]
    if delete_rules:
      platformsettings.ipfw('delete', *delete_rules)
dataset/ETHPy150Open chromium/web-page-replay/trafficshaper.py/TrafficShaper._delete_rules/original