code: func (p *Profile) PruneFrom(dropRx *regexp.Regexp) {
  	pruneBeneath := make(map[uint64]bool)
  
  	for _, loc := range p.Location {
  		for i := 0; i < len(loc.Line); i++ {
  			if fn := loc.Line[i].Function; fn != nil && fn.Name != "" {
  				funcName := simplifyFunc(fn.Name)
  				if dropRx.MatchString(funcName) {
  					// Found matching entry to prune.
  					pruneBeneath[loc.ID] = true
  					loc.Line = loc.Line[i:]
  					break
  				}
  			}
  		}
  	}
  
  	// Prune locs from each Sample
  	for _, sample := range p.Sample {
  		// Scan from the bottom leaf to the root to find the prune location.
  		for i, loc := range sample.Location {
  			if pruneBeneath[loc.ID] {
  				sample.Location = sample.Location[i:]
  				break
  			}
  		}
  	}
  }
docs: // PruneFrom removes all nodes beneath the lowest node matching dropRx, not including itself.
  //
  // Please see the example below to understand this method as well as
  // the difference from Prune method.
  //
  // A sample contains Location of [A,B,C,B,D] where D is the top frame and there's no inline.
  //
  // PruneFrom(A) returns [A,B,C,B,D] because there's no node beneath A.
  // Prune(A, nil) returns [B,C,B,D] by removing A itself.
  //
  // PruneFrom(B) returns [B,C,B,D] by removing all nodes beneath the first B when scanning from the bottom.
  // Prune(B, nil) returns [D] because a matching node is found by scanning from the root.