code: func GroupTransactionsIntoBundles(txs transaction.Transactions) Bundles {
  	bundles := Bundles{}
  
  	for i := range txs {
  		tx := &txs[i]
  		if tx.CurrentIndex != 0 {
  			continue
  		}
  
  		bundle := Bundle{*tx}
  		lastIndex := int(tx.LastIndex)
  		current := tx
  		for x := 1; x <= lastIndex; x++ {
  			// get all txs belonging into this bundle
  			found := false
  			for j := range txs {
  				if current.Bundle != txs[j].Bundle ||
  					txs[j].CurrentIndex != current.CurrentIndex+1 ||
  					current.TrunkTransaction != txs[j].Hash {
  					continue
  				}
  				found = true
  				bundle = append(bundle, txs[j])
  				current = &txs[j]
  				break
  			}
  			if !found {
  				break
  			}
  		}
  		bundles = append(bundles, bundle)
  	}
  
  	return bundles
  }
docs: // GroupTransactionsIntoBundles groups the given transactions into groups of bundles.
  // Note that the same bundle can exist in the return slice multiple times, though they
  // are reattachments of the same transfer.