def get_change_address(node):
    'Get a wallet change address.\n\n    There is no wallet RPC to access unused change addresses, so this creates a\n    dummy transaction, calls fundrawtransaction to give add an input and change\n    output, then returns the change address.'
    dest_address = node.getnewaddress()
    dest_amount = Decimal('0.012345')
    rawtx = node.createrawtransaction([], {dest_address: dest_amount})
    fundtx = node.fundrawtransaction(rawtx)
    info = node.decoderawtransaction(fundtx['hex'])
    return next((address for out in info['vout'] if (out['value'] != dest_amount) for address in out['scriptPubKey']['addresses']))
Get a wallet change address.

There is no wallet RPC to access unused change addresses, so this creates a
dummy transaction, calls fundrawtransaction to give add an input and change
output, then returns the change address.
def get_change_address(node):
    'Get a wallet change address.\n\n    There is no wallet RPC to access unused change addresses, so this creates a\n    dummy transaction, calls fundrawtransaction to give add an input and change\n    output, then returns the change address.'
    dest_address = node.getnewaddress()
    dest_amount = Decimal('0.012345')
    rawtx = node.createrawtransaction([], {dest_address: dest_amount})
    fundtx = node.fundrawtransaction(rawtx)
    info = node.decoderawtransaction(fundtx['hex'])
    return next((address for out in info['vout'] if (out['value'] != dest_amount) for address in out['scriptPubKey']['addresses']))