'Automatically allocates a network for the given project.
:param instance: create the network for the project that owns this
instance
:param neutron: neutron client
:returns: Details of the network that was created.
:raises: nova.exception.UnableToAutoAllocateNetwork
:raises: nova.exception.NetworkNotFound'

def _auto_allocate_network(self, instance, neutron):

    project_id = instance.project_id
    LOG.debug('Automatically    allocating    a    network    for    project    %s.', project_id, instance=instance)
    try:
        topology = neutron.get_auto_allocated_topology(project_id)['auto_allocated_topology']
    except neutron_client_exc.Conflict:
        raise exception.UnableToAutoAllocateNetwork(project_id=project_id)
    try:
        network = neutron.show_network(topology['id'])['network']
    except neutron_client_exc.NetworkNotFoundClient:
        LOG.error(_LE('Automatically    allocated    network    %(network_id)s    was    not    found.'), {'network_id': topology['id']}, instance=instance)
        raise exception.UnableToAutoAllocateNetwork(project_id=project_id)
    LOG.debug('Automatically    allocated    network:    %s', network, instance=instance)
    return network
