docs: def deserialize_transaction(tx_hex):
      """
          Given a serialized transaction, return its inputs, outputs,
          locktime, and version
  
          Each input will have:
          * transaction_hash: string
          * output_index: int
          * [optional] sequence: int
          * [optional] script_sig: string
  
          Each output will have:
          * value: int
          * script_hex: string
      """
  
      tx = bitcoin.deserialize(str(tx_hex))
  
      inputs = tx["ins"]
      outputs = tx["outs"]
  
      ret_inputs = []
      ret_outputs = []
  
      for inp in inputs:
          ret_inp = {
              "transaction_hash": inp["outpoint"]["hash"],
              "output_index": int(inp["outpoint"]["index"]),
          }
  
          if "sequence" in inp:
              ret_inp["sequence"] = int(inp["sequence"])
  
          if "script" in inp:
              ret_inp["script_sig"] = inp["script"]
  
          ret_inputs.append(ret_inp)
  
      for out in outputs:
          ret_out = {
              "value": out["value"],
              "script_hex": out["script"]
          }
  
          ret_outputs.append(ret_out)
  
      return ret_inputs, ret_outputs, tx["locktime"], tx["version"]