code: func (s *SelectionService) GetEndorsersForChaincode(chaincodes []*fab.ChaincodeCall, opts ...copts.Opt) ([]fab.Peer, error) {
  	if len(chaincodes) == 0 {
  		return nil, errors.New("no chaincode IDs provided")
  	}
  
  	params := options.NewParams(opts)
  
  	var chaincodeIDs []string
  	for _, cc := range chaincodes {
  		chaincodeIDs = append(chaincodeIDs, cc.ID)
  	}
  
  	resolver, err := s.getPeerGroupResolver(chaincodeIDs)
  	if err != nil {
  		return nil, errors.WithMessagef(err, "Error getting peer group resolver for chaincodes [%v] on channel [%s]", chaincodeIDs, s.channelID)
  	}
  
  	peers, err := s.discoveryService.GetPeers()
  	if err != nil {
  		return nil, err
  	}
  
  	if params.PeerFilter != nil {
  		var filteredPeers []fab.Peer
  		for _, peer := range peers {
  			if params.PeerFilter(peer) {
  				filteredPeers = append(filteredPeers, peer)
  			} else {
  				logger.Debugf("Peer [%s] is not accepted by the filter and therefore peer group will be excluded.", peer.URL())
  			}
  		}
  		peers = filteredPeers
  	}
  
  	if params.PeerSorter != nil {
  		sortedPeers := make([]fab.Peer, len(peers))
  		copy(sortedPeers, peers)
  		peers = params.PeerSorter(sortedPeers)
  	}
  
  	peerGroup, err := resolver.Resolve(peers)
  	if err != nil {
  		return nil, err
  	}
  	return peerGroup.Peers(), nil
  }
docs: // GetEndorsersForChaincode returns the endorsing peers for the given chaincodes