code: func getChaincodeInstallPackage(cds *pb.ChaincodeDeploymentSpec, cf *ChaincodeCmdFactory) ([]byte, error) {
  	//this can be raw ChaincodeDeploymentSpec or Envelope with signatures
  	var objToWrite proto.Message
  
  	//start with default cds
  	objToWrite = cds
  
  	var err error
  
  	var owner msp.SigningIdentity
  
  	//create a chaincode package...
  	if createSignedCCDepSpec {
  		//...and optionally get the signer so the package can be signed
  		//by the local MSP.  This package can be given to other owners
  		//to sign using "peer chaincode sign <package file>"
  		if signCCDepSpec {
  			if cf.Signer == nil {
  				return nil, fmt.Errorf("Error getting signer")
  			}
  			owner = cf.Signer
  		}
  	}
  
  	ip := instantiationPolicy
  	if ip == "" {
  		//if an instantiation policy is not given, default
  		//to "admin  must sign chaincode instantiation proposals"
  		mspid, err := mspmgmt.GetLocalMSP().GetIdentifier()
  		if err != nil {
  			return nil, err
  		}
  		ip = "AND('" + mspid + ".admin')"
  	}
  
  	sp, err := getInstantiationPolicy(ip)
  	if err != nil {
  		return nil, err
  	}
  
  	//we get the Envelope of type CHAINCODE_PACKAGE
  	objToWrite, err = ccpackage.OwnerCreateSignedCCDepSpec(cds, sp, owner)
  	if err != nil {
  		return nil, err
  	}
  
  	//convert the proto object to bytes
  	bytesToWrite, err := proto.Marshal(objToWrite)
  	if err != nil {
  		return nil, fmt.Errorf("Error marshalling chaincode package : %s", err)
  	}
  
  	return bytesToWrite, nil
  }
docs: //getChaincodeInstallPackage returns either a raw ChaincodeDeploymentSpec or
  //a Envelope with ChaincodeDeploymentSpec and (optional) signature