'Process metering rule actions based specific namespaces.'

def _process_metering_rule_action_based_on_ns(self, router, action, ext_dev, im):

    rm = self.routers.get(router['id'])
    with IptablesManagerTransaction(im):
        labels = router.get(constants.METERING_LABEL_KEY, [])
        for label in labels:
            label_id = label['id']
            label_chain = iptables_manager.get_chain_name(((WRAP_NAME + LABEL) + label_id), wrap=False)
            rules_chain = iptables_manager.get_chain_name(((WRAP_NAME + RULE) + label_id), wrap=False)
            exists = rm.metering_labels.get(label_id)
            if ((action == 'create') and (not exists)):
                self._create_metering_label_chain(rm, label_chain, rules_chain)
                rm.metering_labels[label_id] = label
            rule = label.get('rule')
            if rule:
                if (action == 'create'):
                    self._process_metering_label_rule_add(rule, ext_dev, label_chain, rules_chain, im)
                elif (action == 'delete'):
                    self._process_metering_label_rule_delete(rule, ext_dev, label_chain, rules_chain, im)
