def _choose_overlay_ip(self):
        """
        Get list of used IPs from ZK and randomly choose one from the rest of the subnet.
        :returns: String containing chosen IP.
        """
        try:
            used_ips = {IPv4Address(unicode(ip)) for ip in self.conn.zk.get_children(self.zk_iptoid_path)}
        except NoNodeError:
            used_ips = set()
        available_ips = set(self.conn.network.hosts()) - used_ips
        if not available_ips:
            logger.error("No available IPs found!")
            raise NoAvailableIPsError
        return str(random.sample(available_ips, 1)[0])
dataset/ETHPy150Open facebookarchive/neti/neti/registry.py/Registry._choose_overlay_ip/original