code: func (wc *watchChan) transform(e *event) (res *watch.Event) {
  	curObj, oldObj, err := wc.prepareObjs(e)
  	if err != nil {
  		klog.Errorf("failed to prepare current and previous objects: %v", err)
  		wc.sendError(err)
  		return nil
  	}
  
  	switch {
  	case e.isDeleted:
  		if !wc.filter(oldObj) {
  			return nil
  		}
  		res = &watch.Event{
  			Type:   watch.Deleted,
  			Object: oldObj,
  		}
  	case e.isCreated:
  		if !wc.filter(curObj) {
  			return nil
  		}
  		res = &watch.Event{
  			Type:   watch.Added,
  			Object: curObj,
  		}
  	default:
  		if wc.acceptAll() {
  			res = &watch.Event{
  				Type:   watch.Modified,
  				Object: curObj,
  			}
  			return res
  		}
  		curObjPasses := wc.filter(curObj)
  		oldObjPasses := wc.filter(oldObj)
  		switch {
  		case curObjPasses && oldObjPasses:
  			res = &watch.Event{
  				Type:   watch.Modified,
  				Object: curObj,
  			}
  		case curObjPasses && !oldObjPasses:
  			res = &watch.Event{
  				Type:   watch.Added,
  				Object: curObj,
  			}
  		case !curObjPasses && oldObjPasses:
  			res = &watch.Event{
  				Type:   watch.Deleted,
  				Object: oldObj,
  			}
  		}
  	}
  	return res
  }
docs: // transform transforms an event into a result for user if not filtered.