<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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