code: func GetWitnessSigOpCount(sigScript, pkScript []byte, witness wire.TxWitness) int {
  	// If this is a regular witness program, then we can proceed directly
  	// to counting its signature operations without any further processing.
  	if IsWitnessProgram(pkScript) {
  		return getWitnessSigOps(pkScript, witness)
  	}
  
  	// Next, we'll check the sigScript to see if this is a nested p2sh
  	// witness program. This is a case wherein the sigScript is actually a
  	// datapush of a p2wsh witness program.
  	sigPops, err := parseScript(sigScript)
  	if err != nil {
  		return 0
  	}
  	if IsPayToScriptHash(pkScript) && isPushOnly(sigPops) &&
  		IsWitnessProgram(sigScript[1:]) {
  		return getWitnessSigOps(sigScript[1:], witness)
  	}
  
  	return 0
  }
docs: // GetWitnessSigOpCount returns the number of signature operations generated by
  // spending the passed pkScript with the specified witness, or sigScript.
  // Unlike GetPreciseSigOpCount, this function is able to accurately count the
  // number of signature operations generated by spending witness programs, and
  // nested p2sh witness programs. If the script fails to parse, then the count
  // up to the point of failure is returned.