code: func (daemon *Daemon) NetworksPrune(ctx context.Context, pruneFilters filters.Args) (*types.NetworksPruneReport, error) {
  	if !atomic.CompareAndSwapInt32(&daemon.pruneRunning, 0, 1) {
  		return nil, errPruneRunning
  	}
  	defer atomic.StoreInt32(&daemon.pruneRunning, 0)
  
  	// make sure that only accepted filters have been received
  	err := pruneFilters.Validate(networksAcceptedFilters)
  	if err != nil {
  		return nil, err
  	}
  
  	if _, err := getUntilFromPruneFilters(pruneFilters); err != nil {
  		return nil, err
  	}
  
  	rep := &types.NetworksPruneReport{}
  	if clusterRep, err := daemon.clusterNetworksPrune(ctx, pruneFilters); err == nil {
  		rep.NetworksDeleted = append(rep.NetworksDeleted, clusterRep.NetworksDeleted...)
  	}
  
  	localRep := daemon.localNetworksPrune(ctx, pruneFilters)
  	rep.NetworksDeleted = append(rep.NetworksDeleted, localRep.NetworksDeleted...)
  
  	select {
  	case <-ctx.Done():
  		logrus.Debugf("NetworksPrune operation cancelled: %#v", *rep)
  		return rep, nil
  	default:
  	}
  
  	return rep, nil
  }
docs: // NetworksPrune removes unused networks