def _find_available_overlay_ip(self):
        """
        Get a new IP, and attempt to register it.  If it already is taken, get another.  Retry this cycle for
        MAX_RETRIES. After that, fail on no IPs.
        :returns: String containing overlay IP.
        """
        retries = 0
        ip = self._choose_overlay_ip()
        while retries < constants.MAX_IP_TRIES:
            retries += 1
            try:
                self.conn.zk.create(self._zk_id_path, ip)
                logger.warn("Creating %s" % ip)
            except NoNodeError:
                self.conn.zk.ensure_path(self.zk_idtoip_path)
                logger.error("Path %s did not exist...creating and trying again" % self.zk_idtoip_path)
                continue
            except NodeExistsError:
                try:
                    zk_ip, _ = self.conn.zk.get(self._zk_id_path)
                    logger.error("IP %s already assigned to %s...using that" % (zk_ip, self.conn.instance_id))
                except NoNodeError:
                    logger.error("No IP found...trying again")
                    continue
                return zk_ip
            try:
                zk_ip, _ = self.conn.zk.get(self._zk_id_path)
            except NoNodeError:
                logger.error(ip % "IP %s did not get associated...trying again")
                continue
            if zk_ip == ip:
                logger.info("IP %s set" % ip)
                return ip
            else:
                logger.error("IP %s already assigned to %s...using that" % (zk_ip, self.conn.instance_id))
                return zk_ip

        logger.error("No available IPs found!")
        raise NoAvailableIPsError
dataset/ETHPy150Open facebookarchive/neti/neti/registry.py/Registry._find_available_overlay_ip/swapped operands of `%`