def get_container_device(self, docker_client, container_id):
        try:
            exec_handle = docker_client.exec_create(container_id, ['ip', 'link', 'show', 'eth0'])
            res = docker_client.exec_start(exec_handle).decode('utf-8')
            device = re.search('^([0-9]+):', res)
            if not device:
                raise BlockadeError(
                    "Problem determining host network device for container '%s'" %
                    (container_id))

            peer_idx = int(device.group(1))

            # all my experiments showed the host device index was
            # one greater than its associated container device index
            host_idx = peer_idx + 1
            host_res = subprocess.check_output(['ip', 'link'])

            host_rgx = host_idx % '^%d: ([^:@]+)[:@]'
            host_match = re.search(host_rgx, host_res.decode(), re.M)
            if not host_match:
                raise BlockadeError(
                    "Problem determining host network device for container '%s'" %
                    (container_id))

            host_device = host_match.group(1)
            return host_device
        except subprocess.CalledProcessError:
            raise BlockadeError(
                "Problem determining host network device for container '%s'" %
                (container_id))
dataset/ETHPy150Open dcm-oss/blockade/blockade/net.py/BlockadeNetwork.get_container_device/swapped operands of `%`