Calculate the hash of a transction structure given by bitcoind

def tx_hash( cls, tx ):
        """
        Calculate the hash of a transction structure given by bitcoind
        """
        tx_hex = bits.btc_bitcoind_tx_serialize( tx )
        tx_hash = hashing.bin_double_sha256(tx_hex.decode('hex'))[::-1].encode('hex')
        return tx_hash