code: func (m *Multisig) AddSignature(bndl bundle.Bundle, inputAddr Trytes, key Trytes) ([]Trytes, error) {
  	security := len(key) / SignatureMessageFragmentSizeInTrytes
  	keyTrits, err := TrytesToTrits(key)
  	if err != nil {
  		return nil, err
  	}
  
  	signedFrags := []Trytes{}
  
  	numSignedTxs := 0
  
  	for i := 0; i < len(bndl); i++ {
  		tx := &bndl[i]
  		if tx.Address != inputAddr {
  			continue
  		}
  
  		if !guards.IsEmptyTrytes(tx.SignatureMessageFragment) {
  			numSignedTxs++
  			continue
  		}
  
  		bundleHash := tx.Bundle
  		firstFrag := keyTrits[0:6561]
  		normalizedBundleHash := signing.NormalizedBundleHash(bundleHash)
  		normalizedBundleFrags := [][]int8{}
  
  		for k := 0; k < 3; k++ {
  			normalizedBundleFrags[k] = normalizedBundleHash[k*27 : (k+1)*27]
  		}
  
  		firstBundleFrag := normalizedBundleFrags[numSignedTxs%3]
  		firstSignedFrag, err := signing.SignatureFragment(firstBundleFrag, firstFrag)
  		if err != nil {
  			return nil, err
  		}
  
  		signedFrags = append(signedFrags, MustTritsToTrytes(firstSignedFrag))
  
  		for j := 1; j < security; j++ {
  			nextFrag := keyTrits[6561*j : (j+1)*6561]
  			nextBundleFrag := normalizedBundleFrags[(numSignedTxs+j)%3]
  			nextSignedFrag, err := signing.SignatureFragment(nextBundleFrag, nextFrag)
  			if err != nil {
  				return nil, err
  			}
  			signedFrags = append(signedFrags, MustTritsToTrytes(nextSignedFrag))
  		}
  	}
  
  	return signedFrags, nil
  }
docs: // AddSignature returns cosigner signatures for the transactions.