This is what is implemented in @amueller's clustering code:

https://github.com/amueller/information-theoretic-mst/blob/master/itm.py#L68