code: func Filter(chains [][]*x509.Certificate, f RankingFunc) [][]*x509.Certificate {
  	// If there are no chain or only 1 chain, we are done.
  	if len(chains) <= 1 {
  		return chains
  	}
  
  	bestChain := chains[0]
  	var candidateChains [][]*x509.Certificate
  	for _, chain := range chains {
  		r := f(bestChain, chain)
  		if r < 0 {
  			bestChain = chain
  			candidateChains = [][]*x509.Certificate{chain}
  		} else if r == 0 {
  			candidateChains = append(candidateChains, chain)
  		}
  	}
  	return candidateChains
  }
docs: // Filter filters out the chains with highest rank according to the ranking function f.