func NewPeerGroupResolver(groupHierarchy GroupOfGroups, lbp LoadBalancePolicy) (PeerGroupResolver, error) {
	logger.Debugf("\n***** Policy: %s\n", groupHierarchy)
	mspGroups := groupHierarchy.Reduce()
	s := "\n***** Org Groups:\n"
	for i, g := range mspGroups {
		s += fmt.Sprintf("%s", g)
		if i+1 < len(mspGroups) {
			s += fmt.Sprintf("  OR\n")
		}
	}
	s += fmt.Sprintf("\n")
	logger.Debugf(s)
	return &peerGroupResolver{
		mspGroups: mspGroups,
		lbp:       lbp,
	}, nil
}
NewPeerGroupResolver returns a new PeerGroupResolver
package pgresolver
import (
	"fmt"
	"reflect"
	"github.com/golang/protobuf/proto"
	sdkApi "github.com/hyperledger/fabric-sdk-go/api/apifabclient"
	"github.com/hyperledger/fabric-sdk-go/pkg/logging"
	common "github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common"
	mb "github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/msp"
	"github.com/pkg/errors"
)
var logger = logging.NewLogger("fabric_sdk_go")
type peerGroupResolver struct {
	mspGroups []Group
	lbp       LoadBalancePolicy
}
func NewRoundRobinPeerGroupResolver(sigPolicyEnv *common.SignaturePolicyEnvelope, peerRetriever PeerRetriever) (PeerGroupResolver, error) {
	compiler := NewSignaturePolicyCompiler(peerRetriever)
	groupHierarchy, err := compiler.Compile(sigPolicyEnv)
	if err != nil {
		return nil, errors.WithMessage(err, "error evaluating signature policy")
	}
	return NewPeerGroupResolver(groupHierarchy, NewRoundRobinLBP())
}
func NewRandomPeerGroupResolver(sigPolicyEnv *common.SignaturePolicyEnvelope, peerRetriever PeerRetriever) (PeerGroupResolver, error) {
	compiler := NewSignaturePolicyCompiler(peerRetriever)
	groupHierarchy, err := compiler.Compile(sigPolicyEnv)
	if err != nil {
		return nil, errors.WithMessage(err, "error evaluating signature policy")
	}
	return NewPeerGroupResolver(groupHierarchy, NewRandomLBP())
}