code: func CalcMultiSigStats(script []byte) (int, int, error) {
  	pops, err := parseScript(script)
  	if err != nil {
  		return 0, 0, err
  	}
  
  	// A multi-signature script is of the pattern:
  	//  NUM_SIGS PUBKEY PUBKEY PUBKEY... NUM_PUBKEYS OP_CHECKMULTISIG
  	// Therefore the number of signatures is the oldest item on the stack
  	// and the number of pubkeys is the 2nd to last.  Also, the absolute
  	// minimum for a multi-signature script is 1 pubkey, so at least 4
  	// items must be on the stack per:
  	//  OP_1 PUBKEY OP_1 OP_CHECKMULTISIG
  	if len(pops) < 4 {
  		str := fmt.Sprintf("script %x is not a multisig script", script)
  		return 0, 0, scriptError(ErrNotMultisigScript, str)
  	}
  
  	numSigs := asSmallInt(pops[0].opcode)
  	numPubKeys := asSmallInt(pops[len(pops)-2].opcode)
  	return numPubKeys, numSigs, nil
  }
docs: // CalcMultiSigStats returns the number of public keys and signatures from
  // a multi-signature transaction script.  The passed script MUST already be
  // known to be a multi-signature script.