def find_output_by_address(node, address, txid=None, tx_raw=None):
    """
    Return index to output of txid with address
    Raises exception if there is none.
    """
    assert txid or tx_raw
    txdata = tx_raw if tx_raw else node.getrawtransaction(txid, 1)
    for i in range(len(txdata["vout"])):
        addresses = txdata["vout"][i]["scriptPubKey"]['addresses']
        if len(addresses) == 1 and addresses[0] == address:
            return i
    raise RuntimeError("find_output_by_address txid %s : %s not found" % (txid, address))