code: func trimPvtWSet(pvtWSet *rwset.TxPvtReadWriteSet, filter ledger.PvtNsCollFilter) *rwset.TxPvtReadWriteSet {
  	if filter == nil {
  		return pvtWSet
  	}
  
  	var filteredNsRwSet []*rwset.NsPvtReadWriteSet
  	for _, ns := range pvtWSet.NsPvtRwset {
  		var filteredCollRwSet []*rwset.CollectionPvtReadWriteSet
  		for _, coll := range ns.CollectionPvtRwset {
  			if filter.Has(ns.Namespace, coll.CollectionName) {
  				filteredCollRwSet = append(filteredCollRwSet, coll)
  			}
  		}
  		if filteredCollRwSet != nil {
  			filteredNsRwSet = append(filteredNsRwSet,
  				&rwset.NsPvtReadWriteSet{
  					Namespace:          ns.Namespace,
  					CollectionPvtRwset: filteredCollRwSet,
  				},
  			)
  		}
  	}
  	var filteredTxPvtRwSet *rwset.TxPvtReadWriteSet
  	if filteredNsRwSet != nil {
  		filteredTxPvtRwSet = &rwset.TxPvtReadWriteSet{
  			DataModel:  pvtWSet.GetDataModel(),
  			NsPvtRwset: filteredNsRwSet,
  		}
  	}
  	return filteredTxPvtRwSet
  }
docs: // trimPvtWSet returns a `TxPvtReadWriteSet` that retains only list of 'ns/collections' supplied in the filter
  // A nil filter does not filter any results and returns the original `pvtWSet` as is