code: def _allocate_address(self, instance, network_ids):
          
          log.debug(
              "Trying to allocate floating IP for VM `%s` on network(s) %r",
              instance.id, network_ids)
          try:
              # on python-novaclient>=8.0.0 this fails with
              # `AttributeError` since the `Client.floating_ips`
              # attribute has been removed
              return self._allocate_address_nova(instance, network_ids)
          except AttributeError:
              return self._allocate_address_neutron(instance, network_ids)
docs: Allocates a floating/public ip address to the given instance,
          dispatching to either the Compute or Network API depending
          on installed packages.
  
          :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.
  
          :return: public ip address