'Process metering label based on the associated namespaces.'

def _process_ns_specific_metering_label(self, router, 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 (not exists):
                self._create_metering_label_chain(rm, label_chain, rules_chain)
                rm.metering_labels[label_id] = label
            rules = label.get('rules')
            if rules:
                self._process_metering_label_rules(rules, label_chain, rules_chain, ext_dev, im)
