def get_tx(tx_id, api_code=None):
resource = '<STR_LIT>' + tx_id<EOL>if api_code is not None:<EOL><INDENT>resource += '<STR_LIT>' + api_code<EOL><DEDENT>response = util.call_api(resource)<EOL>json_response = json.loads(response)<EOL>return Transaction(json_response)<EOL>
Get a single transaction based on a transaction hash.

    :param str tx_id: transaction hash to look up
    :param str api_code: Blockchain.info API code (optional)
    :return: an instance of :class:`Transaction` class