Keeping track of volume ids

I want to unite a list of volumes in python. However once I do that I don’t know how to keep track of the volumes created and destroyed. One solution is to assign all the volumes to a block and then unite the block. But this takes a while as assigning each cell to a block seems to be a very slow process.

Any suggestions will be welcome (either to speed up the block assignment or the keeping track of the volume ids)