'Delete a bridge.'

@staticmethod
@utils.synchronized('lock_bridge', external=True)
def remove_bridge(bridge, gateway=True, filtering=True):

    if (not device_exists(bridge)):
        return
    else:
        if filtering:
            ipv4_filter = iptables_manager.ipv4['filter']
            if gateway:
                for rule in get_gateway_rules(bridge):
                    ipv4_filter.remove_rule(*rule)
            else:
                drop_actions = ['DROP']
                if (CONF.iptables_drop_action != 'DROP'):
                    drop_actions.append(CONF.iptables_drop_action)
                for drop_action in drop_actions:
                    ipv4_filter.remove_rule('FORWARD', ('--in-interface    %s    -j    %s' % (bridge, drop_action)))
                    ipv4_filter.remove_rule('FORWARD', ('--out-interface    %s    -j    %s' % (bridge, drop_action)))
        delete_bridge_dev(bridge)
