code: def _allocate_address_nova(self, instance, network_ids):
          
          self._init_os_api()
          with OpenStackCloudProvider.__node_start_lock:
              # Use the `novaclient` API (works with python-novaclient <8.0.0)
              free_ips = [ip for ip in self.nova_client.floating_ips.list() if not ip.fixed_ip]
              if not free_ips:
                  log.debug("Trying to allocate a new floating IP ...")
                  free_ips.append(self.nova_client.floating_ips.create())
              if free_ips:
                  ip = free_ips.pop()
              else:
                  raise RuntimeError(
                      "Could not allocate floating IP for VM {0}"
                      .format(instance_id))
              instance.add_floating_ip(ip)
          return ip.ip
docs: Allocates a floating/public ip address to the given instance,
          using the OpenStack Compute ('Nova') API.
  
          :param instance: instance to assign address to
  
          :param list network_id: List of IDs (as strings) of networks
            where to request allocation the floating IP.  **Ignored**
            (only used by the corresponding Neutron API function).
  
          :return: public ip address