'Deallocates all network structures related to instance.'

def deallocate_for_instance(self, context, instance, requested_networks=None):

    if (not isinstance(instance, obj_base.NovaObject)):
        instance = objects.Instance._from_db_object(context, objects.Instance(), instance)
    requested_networks = self._requested_nets_as_obj_list(requested_networks)
    if (requested_networks and requested_networks.auto_allocate):
        requested_networks = None
    self.network_rpcapi.deallocate_for_instance(context, instance=instance, requested_networks=requested_networks)
