# This file was automatically derived from the JSON-RPC schemas in
# `doc/schemas`. Do not edit this file manually as it would get
# overwritten.

import json


def hexlify(b):
    return b if b is None else b.hex()


def amount2msat(a):
    return a.msat


def amount2sat(a):
    return a.msat / 1000


def remove_default(d):
    # grpc is really not good at empty values, they get replaced with the type's default value...
    return {k: v for k, v in d.items() if v is not None and v != ""}


def getinfo_address2py(m):
    return remove_default({
        "type": str(m.item_type),  # EnumField in generate_composite
        "address": m.address,  # PrimitiveField in generate_composite
        "port": m.port,  # PrimitiveField in generate_composite
    })


def getinfo_binding2py(m):
    return remove_default({
        "type": str(m.item_type),  # EnumField in generate_composite
        "address": m.address,  # PrimitiveField in generate_composite
        "port": m.port,  # PrimitiveField in generate_composite
        "socket": m.socket,  # PrimitiveField in generate_composite
        "subtype": m.subtype,  # PrimitiveField in generate_composite
    })


def getinfo_our_features2py(m):
    return remove_default({
        "channel": hexlify(m.channel),  # PrimitiveField in generate_composite
        "init": hexlify(m.init),  # PrimitiveField in generate_composite
        "invoice": hexlify(m.invoice),  # PrimitiveField in generate_composite
        "node": hexlify(m.node),  # PrimitiveField in generate_composite
    })


def getinfo2py(m):
    return remove_default({
        "address": [getinfo_address2py(i) for i in m.address],  # ArrayField[composite] in generate_composite
        "binding": [getinfo_binding2py(i) for i in m.binding],  # ArrayField[composite] in generate_composite
        "alias": m.alias,  # PrimitiveField in generate_composite
        "blockheight": m.blockheight,  # PrimitiveField in generate_composite
        "color": hexlify(m.color),  # PrimitiveField in generate_composite
        "fees_collected_msat": amount2msat(m.fees_collected_msat),  # PrimitiveField in generate_composite
        "id": hexlify(m.id),  # PrimitiveField in generate_composite
        "lightning_dir": m.lightning_dir,  # PrimitiveField in generate_composite
        "network": m.network,  # PrimitiveField in generate_composite
        "num_active_channels": m.num_active_channels,  # PrimitiveField in generate_composite
        "num_inactive_channels": m.num_inactive_channels,  # PrimitiveField in generate_composite
        "num_peers": m.num_peers,  # PrimitiveField in generate_composite
        "num_pending_channels": m.num_pending_channels,  # PrimitiveField in generate_composite
        "version": m.version,  # PrimitiveField in generate_composite
        "warning_bitcoind_sync": m.warning_bitcoind_sync,  # PrimitiveField in generate_composite
        "warning_lightningd_sync": m.warning_lightningd_sync,  # PrimitiveField in generate_composite
    })


def listpeers_peers_log2py(m):
    return remove_default({
        "type": str(m.item_type),  # EnumField in generate_composite
        "data": hexlify(m.data),  # PrimitiveField in generate_composite
        "log": m.log,  # PrimitiveField in generate_composite
        "node_id": hexlify(m.node_id),  # PrimitiveField in generate_composite
        "num_skipped": m.num_skipped,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
        "time": m.time,  # PrimitiveField in generate_composite
    })


def listpeers_peers2py(m):
    return remove_default({
        "log": [listpeers_peers_log2py(i) for i in m.log],  # ArrayField[composite] in generate_composite
        "netaddr": [m.netaddr for i in m.netaddr], # ArrayField[primitive] in generate_composite
        "connected": m.connected,  # PrimitiveField in generate_composite
        "features": hexlify(m.features),  # PrimitiveField in generate_composite
        "id": hexlify(m.id),  # PrimitiveField in generate_composite
        "num_channels": m.num_channels,  # PrimitiveField in generate_composite
        "remote_addr": m.remote_addr,  # PrimitiveField in generate_composite
    })


def listpeers2py(m):
    return remove_default({
        "peers": [listpeers_peers2py(i) for i in m.peers],  # ArrayField[composite] in generate_composite
    })


def listfunds_channels2py(m):
    return remove_default({
        "state": str(m.state),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "channel_id": hexlify(m.channel_id),  # PrimitiveField in generate_composite
        "connected": m.connected,  # PrimitiveField in generate_composite
        "funding_output": m.funding_output,  # PrimitiveField in generate_composite
        "funding_txid": hexlify(m.funding_txid),  # PrimitiveField in generate_composite
        "our_amount_msat": amount2msat(m.our_amount_msat),  # PrimitiveField in generate_composite
        "peer_id": hexlify(m.peer_id),  # PrimitiveField in generate_composite
        "short_channel_id": m.short_channel_id,  # PrimitiveField in generate_composite
    })


def listfunds_outputs2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "address": m.address,  # PrimitiveField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "blockheight": m.blockheight,  # PrimitiveField in generate_composite
        "output": m.output,  # PrimitiveField in generate_composite
        "redeemscript": hexlify(m.redeemscript),  # PrimitiveField in generate_composite
        "reserved": m.reserved,  # PrimitiveField in generate_composite
        "reserved_to_block": m.reserved_to_block,  # PrimitiveField in generate_composite
        "scriptpubkey": hexlify(m.scriptpubkey),  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def listfunds2py(m):
    return remove_default({
        "channels": [listfunds_channels2py(i) for i in m.channels],  # ArrayField[composite] in generate_composite
        "outputs": [listfunds_outputs2py(i) for i in m.outputs],  # ArrayField[composite] in generate_composite
    })


def sendpay2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "completed_at": m.completed_at,  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "groupid": m.groupid,  # PrimitiveField in generate_composite
        "id": m.id,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "message": m.message,  # PrimitiveField in generate_composite
        "partid": m.partid,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def listchannels_channels2py(m):
    return remove_default({
        "active": m.active,  # PrimitiveField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "base_fee_millisatoshi": m.base_fee_millisatoshi,  # PrimitiveField in generate_composite
        "channel_flags": m.channel_flags,  # PrimitiveField in generate_composite
        "delay": m.delay,  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "direction": m.direction,  # PrimitiveField in generate_composite
        "features": hexlify(m.features),  # PrimitiveField in generate_composite
        "fee_per_millionth": m.fee_per_millionth,  # PrimitiveField in generate_composite
        "htlc_maximum_msat": amount2msat(m.htlc_maximum_msat),  # PrimitiveField in generate_composite
        "htlc_minimum_msat": amount2msat(m.htlc_minimum_msat),  # PrimitiveField in generate_composite
        "last_update": m.last_update,  # PrimitiveField in generate_composite
        "message_flags": m.message_flags,  # PrimitiveField in generate_composite
        "public": m.public,  # PrimitiveField in generate_composite
        "short_channel_id": m.short_channel_id,  # PrimitiveField in generate_composite
        "source": hexlify(m.source),  # PrimitiveField in generate_composite
    })


def listchannels2py(m):
    return remove_default({
        "channels": [listchannels_channels2py(i) for i in m.channels],  # ArrayField[composite] in generate_composite
    })


def addgossip2py(m):
    return remove_default({
    })


def addpsbtoutput2py(m):
    return remove_default({
        "estimated_added_weight": m.estimated_added_weight,  # PrimitiveField in generate_composite
        "outnum": m.outnum,  # PrimitiveField in generate_composite
        "psbt": m.psbt,  # PrimitiveField in generate_composite
    })


def autoclean_once_autoclean_expiredinvoices2py(m):
    return remove_default({
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "uncleaned": m.uncleaned,  # PrimitiveField in generate_composite
    })


def autoclean_once_autoclean_failedforwards2py(m):
    return remove_default({
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "uncleaned": m.uncleaned,  # PrimitiveField in generate_composite
    })


def autoclean_once_autoclean_failedpays2py(m):
    return remove_default({
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "uncleaned": m.uncleaned,  # PrimitiveField in generate_composite
    })


def autoclean_once_autoclean_networkevents2py(m):
    return remove_default({
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "uncleaned": m.uncleaned,  # PrimitiveField in generate_composite
    })


def autoclean_once_autoclean_paidinvoices2py(m):
    return remove_default({
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "uncleaned": m.uncleaned,  # PrimitiveField in generate_composite
    })


def autoclean_once_autoclean_succeededforwards2py(m):
    return remove_default({
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "uncleaned": m.uncleaned,  # PrimitiveField in generate_composite
    })


def autoclean_once_autoclean_succeededpays2py(m):
    return remove_default({
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "uncleaned": m.uncleaned,  # PrimitiveField in generate_composite
    })


def autoclean_once_autoclean2py(m):
    return remove_default({
    })


def autoclean_once2py(m):
    return remove_default({
    })


def autoclean_status_autoclean_expiredinvoices2py(m):
    return remove_default({
        "age": m.age,  # PrimitiveField in generate_composite
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "enabled": m.enabled,  # PrimitiveField in generate_composite
    })


def autoclean_status_autoclean_failedforwards2py(m):
    return remove_default({
        "age": m.age,  # PrimitiveField in generate_composite
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "enabled": m.enabled,  # PrimitiveField in generate_composite
    })


def autoclean_status_autoclean_failedpays2py(m):
    return remove_default({
        "age": m.age,  # PrimitiveField in generate_composite
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "enabled": m.enabled,  # PrimitiveField in generate_composite
    })


def autoclean_status_autoclean_networkevents2py(m):
    return remove_default({
        "age": m.age,  # PrimitiveField in generate_composite
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "enabled": m.enabled,  # PrimitiveField in generate_composite
    })


def autoclean_status_autoclean_paidinvoices2py(m):
    return remove_default({
        "age": m.age,  # PrimitiveField in generate_composite
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "enabled": m.enabled,  # PrimitiveField in generate_composite
    })


def autoclean_status_autoclean_succeededforwards2py(m):
    return remove_default({
        "age": m.age,  # PrimitiveField in generate_composite
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "enabled": m.enabled,  # PrimitiveField in generate_composite
    })


def autoclean_status_autoclean_succeededpays2py(m):
    return remove_default({
        "age": m.age,  # PrimitiveField in generate_composite
        "cleaned": m.cleaned,  # PrimitiveField in generate_composite
        "enabled": m.enabled,  # PrimitiveField in generate_composite
    })


def autoclean_status_autoclean2py(m):
    return remove_default({
    })


def autoclean_status2py(m):
    return remove_default({
    })


def checkmessage2py(m):
    return remove_default({
        "pubkey": hexlify(m.pubkey),  # PrimitiveField in generate_composite
        "verified": m.verified,  # PrimitiveField in generate_composite
    })


def close2py(m):
    return remove_default({
        "txids": [hexlify(m.txids) for i in hexlify(m.txids)], # ArrayField[primitive] in generate_composite
        "txs": [hexlify(m.txs) for i in hexlify(m.txs)], # ArrayField[primitive] in generate_composite
        "type": str(m.item_type),  # EnumField in generate_composite
    })


def connect_address2py(m):
    return remove_default({
        "type": str(m.item_type),  # EnumField in generate_composite
        "address": m.address,  # PrimitiveField in generate_composite
        "port": m.port,  # PrimitiveField in generate_composite
        "socket": m.socket,  # PrimitiveField in generate_composite
    })


def connect2py(m):
    return remove_default({
        "direction": str(m.direction),  # EnumField in generate_composite
        "features": hexlify(m.features),  # PrimitiveField in generate_composite
        "id": hexlify(m.id),  # PrimitiveField in generate_composite
    })


def createinvoice_paid_outpoint2py(m):
    return remove_default({
        "outnum": m.outnum,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def createinvoice2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_received_msat": amount2msat(m.amount_received_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "expires_at": m.expires_at,  # PrimitiveField in generate_composite
        "invreq_payer_note": m.invreq_payer_note,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "local_offer_id": hexlify(m.local_offer_id),  # PrimitiveField in generate_composite
        "paid_at": m.paid_at,  # PrimitiveField in generate_composite
        "pay_index": m.pay_index,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
    })


def datastore2py(m):
    return remove_default({
        "key": [m.key for i in m.key], # ArrayField[primitive] in generate_composite
        "generation": m.generation,  # PrimitiveField in generate_composite
        "hex": hexlify(m.hex),  # PrimitiveField in generate_composite
        "string": m.string,  # PrimitiveField in generate_composite
    })


def datastoreusage_datastoreusage2py(m):
    return remove_default({
        "key": m.key,  # PrimitiveField in generate_composite
        "total_bytes": m.total_bytes,  # PrimitiveField in generate_composite
    })


def datastoreusage2py(m):
    return remove_default({
    })


def createonion2py(m):
    return remove_default({
        "shared_secrets": [hexlify(m.shared_secrets) for i in hexlify(m.shared_secrets)], # ArrayField[primitive] in generate_composite
        "onion": hexlify(m.onion),  # PrimitiveField in generate_composite
    })


def deldatastore2py(m):
    return remove_default({
        "key": [m.key for i in m.key], # ArrayField[primitive] in generate_composite
        "generation": m.generation,  # PrimitiveField in generate_composite
        "hex": hexlify(m.hex),  # PrimitiveField in generate_composite
        "string": m.string,  # PrimitiveField in generate_composite
    })


def delinvoice2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_received_msat": amount2msat(m.amount_received_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "expires_at": m.expires_at,  # PrimitiveField in generate_composite
        "invreq_payer_note": m.invreq_payer_note,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "local_offer_id": hexlify(m.local_offer_id),  # PrimitiveField in generate_composite
        "paid_at": m.paid_at,  # PrimitiveField in generate_composite
        "pay_index": m.pay_index,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def dev_forget_channel2py(m):
    return remove_default({
        "forced": m.forced,  # PrimitiveField in generate_composite
        "funding_txid": hexlify(m.funding_txid),  # PrimitiveField in generate_composite
        "funding_unspent": m.funding_unspent,  # PrimitiveField in generate_composite
    })


def emergencyrecover2py(m):
    return remove_default({
        "stubs": [hexlify(m.stubs) for i in hexlify(m.stubs)], # ArrayField[primitive] in generate_composite
    })


def getemergencyrecoverdata2py(m):
    return remove_default({
        "backed_up_channel_ids": [hexlify(m.backed_up_channel_ids) for i in hexlify(m.backed_up_channel_ids)], # ArrayField[primitive] in generate_composite
        "can_create_penalty": m.can_create_penalty,  # PrimitiveField in generate_composite
        "filedata": hexlify(m.filedata),  # PrimitiveField in generate_composite
    })


def exposesecret2py(m):
    return remove_default({
        "codex32": m.codex32,  # PrimitiveField in generate_composite
        "identifier": m.identifier,  # PrimitiveField in generate_composite
        "mnemonic": m.mnemonic,  # PrimitiveField in generate_composite
    })


def recover2py(m):
    return remove_default({
        "result": str(m.result),  # EnumField in generate_composite
    })


def recoverchannel2py(m):
    return remove_default({
        "stubs": [m.stubs for i in m.stubs], # ArrayField[primitive] in generate_composite
    })


def invoice2py(m):
    return remove_default({
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "expires_at": m.expires_at,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_secret": hexlify(m.payment_secret),  # PrimitiveField in generate_composite
        "warning_capacity": m.warning_capacity,  # PrimitiveField in generate_composite
        "warning_deadends": m.warning_deadends,  # PrimitiveField in generate_composite
        "warning_mpp": m.warning_mpp,  # PrimitiveField in generate_composite
        "warning_offline": m.warning_offline,  # PrimitiveField in generate_composite
        "warning_private_unused": m.warning_private_unused,  # PrimitiveField in generate_composite
    })


def invoicerequest2py(m):
    return remove_default({
        "active": m.active,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "invreq_id": hexlify(m.invreq_id),  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "single_use": m.single_use,  # PrimitiveField in generate_composite
        "used": m.used,  # PrimitiveField in generate_composite
    })


def disableinvoicerequest2py(m):
    return remove_default({
        "active": m.active,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "invreq_id": hexlify(m.invreq_id),  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "single_use": m.single_use,  # PrimitiveField in generate_composite
        "used": m.used,  # PrimitiveField in generate_composite
    })


def listinvoicerequests_invoicerequests2py(m):
    return remove_default({
        "active": m.active,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "invreq_id": hexlify(m.invreq_id),  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "single_use": m.single_use,  # PrimitiveField in generate_composite
        "used": m.used,  # PrimitiveField in generate_composite
    })


def listinvoicerequests2py(m):
    return remove_default({
        "invoicerequests": [listinvoicerequests_invoicerequests2py(i) for i in m.invoicerequests],  # ArrayField[composite] in generate_composite
    })


def listdatastore_datastore2py(m):
    return remove_default({
        "key": [m.key for i in m.key], # ArrayField[primitive] in generate_composite
        "generation": m.generation,  # PrimitiveField in generate_composite
        "hex": hexlify(m.hex),  # PrimitiveField in generate_composite
        "string": m.string,  # PrimitiveField in generate_composite
    })


def listdatastore2py(m):
    return remove_default({
        "datastore": [listdatastore_datastore2py(i) for i in m.datastore],  # ArrayField[composite] in generate_composite
    })


def listinvoices_invoices_paid_outpoint2py(m):
    return remove_default({
        "outnum": m.outnum,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def listinvoices_invoices2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_received_msat": amount2msat(m.amount_received_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "expires_at": m.expires_at,  # PrimitiveField in generate_composite
        "invreq_payer_note": m.invreq_payer_note,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "local_offer_id": hexlify(m.local_offer_id),  # PrimitiveField in generate_composite
        "paid_at": m.paid_at,  # PrimitiveField in generate_composite
        "pay_index": m.pay_index,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def listinvoices2py(m):
    return remove_default({
        "invoices": [listinvoices_invoices2py(i) for i in m.invoices],  # ArrayField[composite] in generate_composite
    })


def sendonion2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "id": m.id,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "message": m.message,  # PrimitiveField in generate_composite
        "partid": m.partid,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def listsendpays_payments2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "completed_at": m.completed_at,  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "erroronion": hexlify(m.erroronion),  # PrimitiveField in generate_composite
        "groupid": m.groupid,  # PrimitiveField in generate_composite
        "id": m.id,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "partid": m.partid,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def listsendpays2py(m):
    return remove_default({
        "payments": [listsendpays_payments2py(i) for i in m.payments],  # ArrayField[composite] in generate_composite
    })


def listtransactions_transactions_inputs2py(m):
    return remove_default({
        "index": m.index,  # PrimitiveField in generate_composite
        "sequence": m.sequence,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def listtransactions_transactions_outputs2py(m):
    return remove_default({
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "index": m.index,  # PrimitiveField in generate_composite
        "script_pub_key": hexlify(m.script_pub_key),  # PrimitiveField in generate_composite
    })


def listtransactions_transactions2py(m):
    return remove_default({
        "inputs": [listtransactions_transactions_inputs2py(i) for i in m.inputs],  # ArrayField[composite] in generate_composite
        "outputs": [listtransactions_transactions_outputs2py(i) for i in m.outputs],  # ArrayField[composite] in generate_composite
        "blockheight": m.blockheight,  # PrimitiveField in generate_composite
        "hash": hexlify(m.hash),  # PrimitiveField in generate_composite
        "locktime": m.locktime,  # PrimitiveField in generate_composite
        "rawtx": hexlify(m.rawtx),  # PrimitiveField in generate_composite
        "txindex": m.txindex,  # PrimitiveField in generate_composite
        "version": m.version,  # PrimitiveField in generate_composite
    })


def listtransactions2py(m):
    return remove_default({
        "transactions": [listtransactions_transactions2py(i) for i in m.transactions],  # ArrayField[composite] in generate_composite
    })


def makesecret2py(m):
    return remove_default({
        "secret": hexlify(m.secret),  # PrimitiveField in generate_composite
    })


def pay2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "parts": m.parts,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "warning_partial_completion": m.warning_partial_completion,  # PrimitiveField in generate_composite
    })


def listnodes_nodes_addresses2py(m):
    return remove_default({
        "type": str(m.item_type),  # EnumField in generate_composite
        "address": m.address,  # PrimitiveField in generate_composite
        "port": m.port,  # PrimitiveField in generate_composite
    })


def listnodes_nodes_option_will_fund2py(m):
    return remove_default({
        "channel_fee_max_base_msat": amount2msat(m.channel_fee_max_base_msat),  # PrimitiveField in generate_composite
        "channel_fee_max_proportional_thousandths": m.channel_fee_max_proportional_thousandths,  # PrimitiveField in generate_composite
        "compact_lease": hexlify(m.compact_lease),  # PrimitiveField in generate_composite
        "funding_weight": m.funding_weight,  # PrimitiveField in generate_composite
        "lease_fee_base_msat": amount2msat(m.lease_fee_base_msat),  # PrimitiveField in generate_composite
        "lease_fee_basis": m.lease_fee_basis,  # PrimitiveField in generate_composite
    })


def listnodes_nodes2py(m):
    return remove_default({
        "addresses": [listnodes_nodes_addresses2py(i) for i in m.addresses],  # ArrayField[composite] in generate_composite
        "alias": m.alias,  # PrimitiveField in generate_composite
        "color": hexlify(m.color),  # PrimitiveField in generate_composite
        "features": hexlify(m.features),  # PrimitiveField in generate_composite
        "last_timestamp": m.last_timestamp,  # PrimitiveField in generate_composite
        "nodeid": hexlify(m.nodeid),  # PrimitiveField in generate_composite
    })


def listnodes2py(m):
    return remove_default({
        "nodes": [listnodes_nodes2py(i) for i in m.nodes],  # ArrayField[composite] in generate_composite
    })


def waitanyinvoice_paid_outpoint2py(m):
    return remove_default({
        "outnum": m.outnum,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def waitanyinvoice2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_received_msat": amount2msat(m.amount_received_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "expires_at": m.expires_at,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "paid_at": m.paid_at,  # PrimitiveField in generate_composite
        "pay_index": m.pay_index,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def waitinvoice_paid_outpoint2py(m):
    return remove_default({
        "outnum": m.outnum,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def waitinvoice2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_received_msat": amount2msat(m.amount_received_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "expires_at": m.expires_at,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "paid_at": m.paid_at,  # PrimitiveField in generate_composite
        "pay_index": m.pay_index,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def waitsendpay2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "completed_at": m.completed_at,  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "groupid": m.groupid,  # PrimitiveField in generate_composite
        "id": m.id,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "partid": m.partid,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def newaddr2py(m):
    return remove_default({
        "bech32": m.bech32,  # PrimitiveField in generate_composite
        "p2tr": m.p2tr,  # PrimitiveField in generate_composite
    })


def withdraw2py(m):
    return remove_default({
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "tx": hexlify(m.tx),  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def keysend2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "parts": m.parts,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "warning_partial_completion": m.warning_partial_completion,  # PrimitiveField in generate_composite
    })


def fundpsbt_reservations2py(m):
    return remove_default({
        "reserved": m.reserved,  # PrimitiveField in generate_composite
        "reserved_to_block": m.reserved_to_block,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
        "vout": m.vout,  # PrimitiveField in generate_composite
        "was_reserved": m.was_reserved,  # PrimitiveField in generate_composite
    })


def fundpsbt2py(m):
    return remove_default({
        "reservations": [fundpsbt_reservations2py(i) for i in m.reservations],  # ArrayField[composite] in generate_composite
        "change_outnum": m.change_outnum,  # PrimitiveField in generate_composite
        "estimated_final_weight": m.estimated_final_weight,  # PrimitiveField in generate_composite
        "excess_msat": amount2msat(m.excess_msat),  # PrimitiveField in generate_composite
        "feerate_per_kw": m.feerate_per_kw,  # PrimitiveField in generate_composite
        "psbt": m.psbt,  # PrimitiveField in generate_composite
    })


def sendpsbt2py(m):
    return remove_default({
        "tx": hexlify(m.tx),  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def signpsbt2py(m):
    return remove_default({
        "signed_psbt": m.signed_psbt,  # PrimitiveField in generate_composite
    })


def utxopsbt_reservations2py(m):
    return remove_default({
        "reserved": m.reserved,  # PrimitiveField in generate_composite
        "reserved_to_block": m.reserved_to_block,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
        "vout": m.vout,  # PrimitiveField in generate_composite
        "was_reserved": m.was_reserved,  # PrimitiveField in generate_composite
    })


def utxopsbt2py(m):
    return remove_default({
        "reservations": [utxopsbt_reservations2py(i) for i in m.reservations],  # ArrayField[composite] in generate_composite
        "change_outnum": m.change_outnum,  # PrimitiveField in generate_composite
        "estimated_final_weight": m.estimated_final_weight,  # PrimitiveField in generate_composite
        "excess_msat": amount2msat(m.excess_msat),  # PrimitiveField in generate_composite
        "feerate_per_kw": m.feerate_per_kw,  # PrimitiveField in generate_composite
        "psbt": m.psbt,  # PrimitiveField in generate_composite
    })


def txdiscard2py(m):
    return remove_default({
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
        "unsigned_tx": hexlify(m.unsigned_tx),  # PrimitiveField in generate_composite
    })


def txprepare2py(m):
    return remove_default({
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
        "unsigned_tx": hexlify(m.unsigned_tx),  # PrimitiveField in generate_composite
    })


def txsend2py(m):
    return remove_default({
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "tx": hexlify(m.tx),  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def listpeerchannels_channels_alias2py(m):
    return remove_default({
        "local": m.local,  # PrimitiveField in generate_composite
        "remote": m.remote,  # PrimitiveField in generate_composite
    })


def listpeerchannels_channels_channel_type2py(m):
    return remove_default({
        "bits": [m.bits for i in m.bits], # ArrayField[primitive] in generate_composite
        "names": [str(i) for i in m.names],  # ArrayField[composite] in generate_composite
    })


def listpeerchannels_channels_feerate2py(m):
    return remove_default({
        "perkb": m.perkb,  # PrimitiveField in generate_composite
        "perkw": m.perkw,  # PrimitiveField in generate_composite
    })


def listpeerchannels_channels_funding2py(m):
    return remove_default({
        "fee_paid_msat": amount2msat(m.fee_paid_msat),  # PrimitiveField in generate_composite
        "fee_rcvd_msat": amount2msat(m.fee_rcvd_msat),  # PrimitiveField in generate_composite
        "local_funds_msat": amount2msat(m.local_funds_msat),  # PrimitiveField in generate_composite
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "pushed_msat": amount2msat(m.pushed_msat),  # PrimitiveField in generate_composite
        "remote_funds_msat": amount2msat(m.remote_funds_msat),  # PrimitiveField in generate_composite
        "withheld": m.withheld,  # PrimitiveField in generate_composite
    })


def listpeerchannels_channels_htlcs2py(m):
    return remove_default({
        "direction": str(m.direction),  # EnumField in generate_composite
        "state": str(m.state),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "expiry": m.expiry,  # PrimitiveField in generate_composite
        "id": m.id,  # PrimitiveField in generate_composite
        "local_trimmed": m.local_trimmed,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "status": m.status,  # PrimitiveField in generate_composite
    })


def listpeerchannels_channels_inflight2py(m):
    return remove_default({
        "feerate": m.feerate,  # PrimitiveField in generate_composite
        "funding_outnum": m.funding_outnum,  # PrimitiveField in generate_composite
        "funding_txid": hexlify(m.funding_txid),  # PrimitiveField in generate_composite
        "our_funding_msat": amount2msat(m.our_funding_msat),  # PrimitiveField in generate_composite
        "scratch_txid": hexlify(m.scratch_txid),  # PrimitiveField in generate_composite
        "splice_amount": m.splice_amount,  # PrimitiveField in generate_composite
        "total_funding_msat": amount2msat(m.total_funding_msat),  # PrimitiveField in generate_composite
    })


def listpeerchannels_channels_state_changes2py(m):
    return remove_default({
        "cause": str(m.cause),  # EnumField in generate_composite
        "new_state": str(m.new_state),  # EnumField in generate_composite
        "old_state": str(m.old_state),  # EnumField in generate_composite
        "message": m.message,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
    })


def listpeerchannels_channels_updates_local2py(m):
    return remove_default({
        "cltv_expiry_delta": m.cltv_expiry_delta,  # PrimitiveField in generate_composite
        "fee_base_msat": amount2msat(m.fee_base_msat),  # PrimitiveField in generate_composite
        "fee_proportional_millionths": m.fee_proportional_millionths,  # PrimitiveField in generate_composite
        "htlc_maximum_msat": amount2msat(m.htlc_maximum_msat),  # PrimitiveField in generate_composite
        "htlc_minimum_msat": amount2msat(m.htlc_minimum_msat),  # PrimitiveField in generate_composite
    })


def listpeerchannels_channels_updates_remote2py(m):
    return remove_default({
        "cltv_expiry_delta": m.cltv_expiry_delta,  # PrimitiveField in generate_composite
        "fee_base_msat": amount2msat(m.fee_base_msat),  # PrimitiveField in generate_composite
        "fee_proportional_millionths": m.fee_proportional_millionths,  # PrimitiveField in generate_composite
        "htlc_maximum_msat": amount2msat(m.htlc_maximum_msat),  # PrimitiveField in generate_composite
        "htlc_minimum_msat": amount2msat(m.htlc_minimum_msat),  # PrimitiveField in generate_composite
    })


def listpeerchannels_channels_updates2py(m):
    return remove_default({
    })


def listpeerchannels_channels2py(m):
    return remove_default({
        "closer": str(m.closer),  # EnumField in generate_composite
        "features": [m.features for i in m.features], # ArrayField[primitive] in generate_composite
        "htlcs": [listpeerchannels_channels_htlcs2py(i) for i in m.htlcs],  # ArrayField[composite] in generate_composite
        "inflight": [listpeerchannels_channels_inflight2py(i) for i in m.inflight],  # ArrayField[composite] in generate_composite
        "opener": str(m.opener),  # EnumField in generate_composite
        "state": str(m.state),  # EnumField in generate_composite
        "state_changes": [listpeerchannels_channels_state_changes2py(i) for i in m.state_changes],  # ArrayField[composite] in generate_composite
        "status": [m.status for i in m.status], # ArrayField[primitive] in generate_composite
        "channel_id": hexlify(m.channel_id),  # PrimitiveField in generate_composite
        "close_to": hexlify(m.close_to),  # PrimitiveField in generate_composite
        "close_to_addr": m.close_to_addr,  # PrimitiveField in generate_composite
        "direction": m.direction,  # PrimitiveField in generate_composite
        "dust_limit_msat": amount2msat(m.dust_limit_msat),  # PrimitiveField in generate_composite
        "fee_base_msat": amount2msat(m.fee_base_msat),  # PrimitiveField in generate_composite
        "fee_proportional_millionths": m.fee_proportional_millionths,  # PrimitiveField in generate_composite
        "funding_outnum": m.funding_outnum,  # PrimitiveField in generate_composite
        "funding_txid": hexlify(m.funding_txid),  # PrimitiveField in generate_composite
        "ignore_fee_limits": m.ignore_fee_limits,  # PrimitiveField in generate_composite
        "in_fulfilled_msat": amount2msat(m.in_fulfilled_msat),  # PrimitiveField in generate_composite
        "in_offered_msat": amount2msat(m.in_offered_msat),  # PrimitiveField in generate_composite
        "in_payments_fulfilled": m.in_payments_fulfilled,  # PrimitiveField in generate_composite
        "in_payments_offered": m.in_payments_offered,  # PrimitiveField in generate_composite
        "initial_feerate": m.initial_feerate,  # PrimitiveField in generate_composite
        "last_feerate": m.last_feerate,  # PrimitiveField in generate_composite
        "last_stable_connection": m.last_stable_connection,  # PrimitiveField in generate_composite
        "last_tx_fee_msat": amount2msat(m.last_tx_fee_msat),  # PrimitiveField in generate_composite
        "lost_state": m.lost_state,  # PrimitiveField in generate_composite
        "max_accepted_htlcs": m.max_accepted_htlcs,  # PrimitiveField in generate_composite
        "max_to_us_msat": amount2msat(m.max_to_us_msat),  # PrimitiveField in generate_composite
        "maximum_htlc_out_msat": amount2msat(m.maximum_htlc_out_msat),  # PrimitiveField in generate_composite
        "min_to_us_msat": amount2msat(m.min_to_us_msat),  # PrimitiveField in generate_composite
        "minimum_htlc_in_msat": amount2msat(m.minimum_htlc_in_msat),  # PrimitiveField in generate_composite
        "minimum_htlc_out_msat": amount2msat(m.minimum_htlc_out_msat),  # PrimitiveField in generate_composite
        "next_fee_step": m.next_fee_step,  # PrimitiveField in generate_composite
        "next_feerate": m.next_feerate,  # PrimitiveField in generate_composite
        "our_max_htlc_value_in_flight_msat": amount2msat(m.our_max_htlc_value_in_flight_msat),  # PrimitiveField in generate_composite
        "our_reserve_msat": amount2msat(m.our_reserve_msat),  # PrimitiveField in generate_composite
        "our_to_self_delay": m.our_to_self_delay,  # PrimitiveField in generate_composite
        "out_fulfilled_msat": amount2msat(m.out_fulfilled_msat),  # PrimitiveField in generate_composite
        "out_offered_msat": amount2msat(m.out_offered_msat),  # PrimitiveField in generate_composite
        "out_payments_fulfilled": m.out_payments_fulfilled,  # PrimitiveField in generate_composite
        "out_payments_offered": m.out_payments_offered,  # PrimitiveField in generate_composite
        "owner": m.owner,  # PrimitiveField in generate_composite
        "peer_connected": m.peer_connected,  # PrimitiveField in generate_composite
        "peer_id": hexlify(m.peer_id),  # PrimitiveField in generate_composite
        "private": m.private,  # PrimitiveField in generate_composite
        "receivable_msat": amount2msat(m.receivable_msat),  # PrimitiveField in generate_composite
        "reestablished": m.reestablished,  # PrimitiveField in generate_composite
        "scratch_txid": hexlify(m.scratch_txid),  # PrimitiveField in generate_composite
        "short_channel_id": m.short_channel_id,  # PrimitiveField in generate_composite
        "spendable_msat": amount2msat(m.spendable_msat),  # PrimitiveField in generate_composite
        "their_max_htlc_value_in_flight_msat": amount2msat(m.their_max_htlc_value_in_flight_msat),  # PrimitiveField in generate_composite
        "their_reserve_msat": amount2msat(m.their_reserve_msat),  # PrimitiveField in generate_composite
        "their_to_self_delay": m.their_to_self_delay,  # PrimitiveField in generate_composite
        "to_us_msat": amount2msat(m.to_us_msat),  # PrimitiveField in generate_composite
        "total_msat": amount2msat(m.total_msat),  # PrimitiveField in generate_composite
    })


def listpeerchannels2py(m):
    return remove_default({
        "channels": [listpeerchannels_channels2py(i) for i in m.channels],  # ArrayField[composite] in generate_composite
    })


def listclosedchannels_closedchannels_alias2py(m):
    return remove_default({
        "local": m.local,  # PrimitiveField in generate_composite
        "remote": m.remote,  # PrimitiveField in generate_composite
    })


def listclosedchannels_closedchannels_channel_type2py(m):
    return remove_default({
        "bits": [m.bits for i in m.bits], # ArrayField[primitive] in generate_composite
        "names": [str(i) for i in m.names],  # ArrayField[composite] in generate_composite
    })


def listclosedchannels_closedchannels2py(m):
    return remove_default({
        "close_cause": str(m.close_cause),  # EnumField in generate_composite
        "closer": str(m.closer),  # EnumField in generate_composite
        "opener": str(m.opener),  # EnumField in generate_composite
        "channel_id": hexlify(m.channel_id),  # PrimitiveField in generate_composite
        "final_to_us_msat": amount2msat(m.final_to_us_msat),  # PrimitiveField in generate_composite
        "funding_fee_paid_msat": amount2msat(m.funding_fee_paid_msat),  # PrimitiveField in generate_composite
        "funding_fee_rcvd_msat": amount2msat(m.funding_fee_rcvd_msat),  # PrimitiveField in generate_composite
        "funding_outnum": m.funding_outnum,  # PrimitiveField in generate_composite
        "funding_psbt": m.funding_psbt,  # PrimitiveField in generate_composite
        "funding_pushed_msat": amount2msat(m.funding_pushed_msat),  # PrimitiveField in generate_composite
        "funding_txid": hexlify(m.funding_txid),  # PrimitiveField in generate_composite
        "funding_withheld": m.funding_withheld,  # PrimitiveField in generate_composite
        "last_commitment_fee_msat": amount2msat(m.last_commitment_fee_msat),  # PrimitiveField in generate_composite
        "last_commitment_txid": hexlify(m.last_commitment_txid),  # PrimitiveField in generate_composite
        "last_stable_connection": m.last_stable_connection,  # PrimitiveField in generate_composite
        "leased": m.leased,  # PrimitiveField in generate_composite
        "max_to_us_msat": amount2msat(m.max_to_us_msat),  # PrimitiveField in generate_composite
        "min_to_us_msat": amount2msat(m.min_to_us_msat),  # PrimitiveField in generate_composite
        "peer_id": hexlify(m.peer_id),  # PrimitiveField in generate_composite
        "private": m.private,  # PrimitiveField in generate_composite
        "short_channel_id": m.short_channel_id,  # PrimitiveField in generate_composite
        "total_htlcs_sent": m.total_htlcs_sent,  # PrimitiveField in generate_composite
        "total_local_commitments": m.total_local_commitments,  # PrimitiveField in generate_composite
        "total_msat": amount2msat(m.total_msat),  # PrimitiveField in generate_composite
        "total_remote_commitments": m.total_remote_commitments,  # PrimitiveField in generate_composite
    })


def listclosedchannels2py(m):
    return remove_default({
        "closedchannels": [listclosedchannels_closedchannels2py(i) for i in m.closedchannels],  # ArrayField[composite] in generate_composite
    })


def decode_extra2py(m):
    return remove_default({
        "data": m.data,  # PrimitiveField in generate_composite
        "tag": m.tag,  # PrimitiveField in generate_composite
    })


def decode_fallbacks2py(m):
    return remove_default({
        "type": str(m.item_type),  # EnumField in generate_composite
        "addr": m.addr,  # PrimitiveField in generate_composite
        "hex": hexlify(m.hex),  # PrimitiveField in generate_composite
    })


def decode_invoice_fallbacks2py(m):
    return remove_default({
        "address": m.address,  # PrimitiveField in generate_composite
        "hex": hexlify(m.hex),  # PrimitiveField in generate_composite
        "version": m.version,  # PrimitiveField in generate_composite
    })


def decode_invoice_paths_path2py(m):
    return remove_default({
        "blinded_node_id": hexlify(m.blinded_node_id),  # PrimitiveField in generate_composite
        "encrypted_recipient_data": hexlify(m.encrypted_recipient_data),  # PrimitiveField in generate_composite
    })


def decode_invoice_paths_payinfo2py(m):
    return remove_default({
        "cltv_expiry_delta": m.cltv_expiry_delta,  # PrimitiveField in generate_composite
        "features": hexlify(m.features),  # PrimitiveField in generate_composite
        "fee_base_msat": amount2msat(m.fee_base_msat),  # PrimitiveField in generate_composite
        "fee_proportional_millionths": m.fee_proportional_millionths,  # PrimitiveField in generate_composite
        "htlc_maximum_msat": amount2msat(m.htlc_maximum_msat),  # PrimitiveField in generate_composite
        "htlc_minimum_msat": amount2msat(m.htlc_minimum_msat),  # PrimitiveField in generate_composite
    })


def decode_invoice_paths2py(m):
    return remove_default({
        "path": [decode_invoice_paths_path2py(i) for i in m.path],  # ArrayField[composite] in generate_composite
        "first_node_id": hexlify(m.first_node_id),  # PrimitiveField in generate_composite
        "first_path_key": hexlify(m.first_path_key),  # PrimitiveField in generate_composite
        "first_scid": m.first_scid,  # PrimitiveField in generate_composite
        "first_scid_dir": m.first_scid_dir,  # PrimitiveField in generate_composite
    })


def decode_invreq_bip_353_name2py(m):
    return remove_default({
        "domain": m.domain,  # PrimitiveField in generate_composite
        "name": m.name,  # PrimitiveField in generate_composite
    })


def decode_invreq_paths_path2py(m):
    return remove_default({
        "blinded_node_id": hexlify(m.blinded_node_id),  # PrimitiveField in generate_composite
        "encrypted_recipient_data": hexlify(m.encrypted_recipient_data),  # PrimitiveField in generate_composite
    })


def decode_invreq_paths2py(m):
    return remove_default({
        "path": [decode_invreq_paths_path2py(i) for i in m.path],  # ArrayField[composite] in generate_composite
        "first_node_id": hexlify(m.first_node_id),  # PrimitiveField in generate_composite
        "first_path_key": hexlify(m.first_path_key),  # PrimitiveField in generate_composite
        "first_scid": m.first_scid,  # PrimitiveField in generate_composite
        "first_scid_dir": m.first_scid_dir,  # PrimitiveField in generate_composite
    })


def decode_offer_paths_path2py(m):
    return remove_default({
        "blinded_node_id": hexlify(m.blinded_node_id),  # PrimitiveField in generate_composite
        "encrypted_recipient_data": hexlify(m.encrypted_recipient_data),  # PrimitiveField in generate_composite
    })


def decode_offer_paths2py(m):
    return remove_default({
        "path": [decode_offer_paths_path2py(i) for i in m.path],  # ArrayField[composite] in generate_composite
        "first_node_id": hexlify(m.first_node_id),  # PrimitiveField in generate_composite
        "first_path_key": hexlify(m.first_path_key),  # PrimitiveField in generate_composite
        "first_scid": m.first_scid,  # PrimitiveField in generate_composite
        "first_scid_dir": m.first_scid_dir,  # PrimitiveField in generate_composite
    })


def decode_offer_recurrence_paywindow2py(m):
    return remove_default({
        "proportional_amount": m.proportional_amount,  # PrimitiveField in generate_composite
        "seconds_after": m.seconds_after,  # PrimitiveField in generate_composite
        "seconds_before": m.seconds_before,  # PrimitiveField in generate_composite
    })


def decode_offer_recurrence2py(m):
    return remove_default({
        "basetime": m.basetime,  # PrimitiveField in generate_composite
        "compulsory_field": m.compulsory_field,  # PrimitiveField in generate_composite
        "limit": m.limit,  # PrimitiveField in generate_composite
        "period": m.period,  # PrimitiveField in generate_composite
        "time_unit": m.time_unit,  # PrimitiveField in generate_composite
        "time_unit_name": m.time_unit_name,  # PrimitiveField in generate_composite
    })


def decode_restrictions2py(m):
    return remove_default({
        "alternatives": [m.alternatives for i in m.alternatives], # ArrayField[primitive] in generate_composite
        "summary": m.summary,  # PrimitiveField in generate_composite
    })


def decode_unknown_invoice_request_tlvs2py(m):
    return remove_default({
        "length": m.length,  # PrimitiveField in generate_composite
        "item_type": m.type,  # PrimitiveField in generate_composite
        "value": hexlify(m.value),  # PrimitiveField in generate_composite
    })


def decode_unknown_invoice_tlvs2py(m):
    return remove_default({
        "length": m.length,  # PrimitiveField in generate_composite
        "item_type": m.type,  # PrimitiveField in generate_composite
        "value": hexlify(m.value),  # PrimitiveField in generate_composite
    })


def decode_unknown_offer_tlvs2py(m):
    return remove_default({
        "length": m.length,  # PrimitiveField in generate_composite
        "item_type": m.type,  # PrimitiveField in generate_composite
        "value": hexlify(m.value),  # PrimitiveField in generate_composite
    })


def decode_unknown_payer_proof_tlvs2py(m):
    return remove_default({
        "length": m.length,  # PrimitiveField in generate_composite
        "item_type": m.type,  # PrimitiveField in generate_composite
        "value": hexlify(m.value),  # PrimitiveField in generate_composite
    })


def decode2py(m):
    return remove_default({
        "extra": [decode_extra2py(i) for i in m.extra],  # ArrayField[composite] in generate_composite
        "fallbacks": [decode_fallbacks2py(i) for i in m.fallbacks],  # ArrayField[composite] in generate_composite
        "invoice_fallbacks": [decode_invoice_fallbacks2py(i) for i in m.invoice_fallbacks],  # ArrayField[composite] in generate_composite
        "invoice_paths": [decode_invoice_paths2py(i) for i in m.invoice_paths],  # ArrayField[composite] in generate_composite
        "invreq_paths": [decode_invreq_paths2py(i) for i in m.invreq_paths],  # ArrayField[composite] in generate_composite
        "offer_chains": [hexlify(m.offer_chains) for i in hexlify(m.offer_chains)], # ArrayField[primitive] in generate_composite
        "offer_paths": [decode_offer_paths2py(i) for i in m.offer_paths],  # ArrayField[composite] in generate_composite
        "proof_leaf_hashes": [hexlify(m.proof_leaf_hashes) for i in hexlify(m.proof_leaf_hashes)], # ArrayField[primitive] in generate_composite
        "proof_missing_hashes": [hexlify(m.proof_missing_hashes) for i in hexlify(m.proof_missing_hashes)], # ArrayField[primitive] in generate_composite
        "proof_omitted_tlvs": [m.proof_omitted_tlvs for i in m.proof_omitted_tlvs], # ArrayField[primitive] in generate_composite
        "restrictions": [decode_restrictions2py(i) for i in m.restrictions],  # ArrayField[composite] in generate_composite
        "type": str(m.item_type),  # EnumField in generate_composite
        "unknown_invoice_request_tlvs": [decode_unknown_invoice_request_tlvs2py(i) for i in m.unknown_invoice_request_tlvs],  # ArrayField[composite] in generate_composite
        "unknown_invoice_tlvs": [decode_unknown_invoice_tlvs2py(i) for i in m.unknown_invoice_tlvs],  # ArrayField[composite] in generate_composite
        "unknown_offer_tlvs": [decode_unknown_offer_tlvs2py(i) for i in m.unknown_offer_tlvs],  # ArrayField[composite] in generate_composite
        "unknown_payer_proof_tlvs": [decode_unknown_payer_proof_tlvs2py(i) for i in m.unknown_payer_proof_tlvs],  # ArrayField[composite] in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
        "currency": m.currency,  # PrimitiveField in generate_composite
        "currency_minor_unit": m.currency_minor_unit,  # PrimitiveField in generate_composite
        "decrypted": hexlify(m.decrypted),  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "description_hash": hexlify(m.description_hash),  # PrimitiveField in generate_composite
        "expiry": m.expiry,  # PrimitiveField in generate_composite
        "features": hexlify(m.features),  # PrimitiveField in generate_composite
        "hex": hexlify(m.hex),  # PrimitiveField in generate_composite
        "invoice_amount_msat": amount2msat(m.invoice_amount_msat),  # PrimitiveField in generate_composite
        "invoice_created_at": m.invoice_created_at,  # PrimitiveField in generate_composite
        "invoice_features": hexlify(m.invoice_features),  # PrimitiveField in generate_composite
        "invoice_node_id": hexlify(m.invoice_node_id),  # PrimitiveField in generate_composite
        "invoice_payment_hash": hexlify(m.invoice_payment_hash),  # PrimitiveField in generate_composite
        "invoice_recurrence_basetime": m.invoice_recurrence_basetime,  # PrimitiveField in generate_composite
        "invoice_relative_expiry": m.invoice_relative_expiry,  # PrimitiveField in generate_composite
        "invreq_amount_msat": amount2msat(m.invreq_amount_msat),  # PrimitiveField in generate_composite
        "invreq_chain": hexlify(m.invreq_chain),  # PrimitiveField in generate_composite
        "invreq_features": hexlify(m.invreq_features),  # PrimitiveField in generate_composite
        "invreq_metadata": hexlify(m.invreq_metadata),  # PrimitiveField in generate_composite
        "invreq_payer_id": hexlify(m.invreq_payer_id),  # PrimitiveField in generate_composite
        "invreq_payer_note": m.invreq_payer_note,  # PrimitiveField in generate_composite
        "invreq_quantity": m.invreq_quantity,  # PrimitiveField in generate_composite
        "invreq_recurrence_cancel": m.invreq_recurrence_cancel,  # PrimitiveField in generate_composite
        "invreq_recurrence_counter": m.invreq_recurrence_counter,  # PrimitiveField in generate_composite
        "invreq_recurrence_start": m.invreq_recurrence_start,  # PrimitiveField in generate_composite
        "min_final_cltv_expiry": m.min_final_cltv_expiry,  # PrimitiveField in generate_composite
        "offer_absolute_expiry": m.offer_absolute_expiry,  # PrimitiveField in generate_composite
        "offer_amount": m.offer_amount,  # PrimitiveField in generate_composite
        "offer_amount_msat": amount2msat(m.offer_amount_msat),  # PrimitiveField in generate_composite
        "offer_currency": m.offer_currency,  # PrimitiveField in generate_composite
        "offer_description": m.offer_description,  # PrimitiveField in generate_composite
        "offer_features": hexlify(m.offer_features),  # PrimitiveField in generate_composite
        "offer_id": hexlify(m.offer_id),  # PrimitiveField in generate_composite
        "offer_issuer": m.offer_issuer,  # PrimitiveField in generate_composite
        "offer_issuer_id": hexlify(m.offer_issuer_id),  # PrimitiveField in generate_composite
        "offer_metadata": hexlify(m.offer_metadata),  # PrimitiveField in generate_composite
        "offer_quantity_max": m.offer_quantity_max,  # PrimitiveField in generate_composite
        "payee": hexlify(m.payee),  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_metadata": hexlify(m.payment_metadata),  # PrimitiveField in generate_composite
        "payment_secret": hexlify(m.payment_secret),  # PrimitiveField in generate_composite
        "proof_note": m.proof_note,  # PrimitiveField in generate_composite
        "proof_preimage": hexlify(m.proof_preimage),  # PrimitiveField in generate_composite
        "proof_signature": hexlify(m.proof_signature),  # PrimitiveField in generate_composite
        "routes": [[decodepay_routes2py(i) for i in routehints] for routehints in m.routes],  # OverrideField in DecodeRoutehintList
        "signature": hexlify(m.signature),  # PrimitiveField in generate_composite
        "string": m.string,  # PrimitiveField in generate_composite
        "unique_id": m.unique_id,  # PrimitiveField in generate_composite
        "valid": m.valid,  # PrimitiveField in generate_composite
        "version": m.version,  # PrimitiveField in generate_composite
        "warning_empty_blinded_path": m.warning_empty_blinded_path,  # PrimitiveField in generate_composite
        "warning_invalid_invoice_request_signature": m.warning_invalid_invoice_request_signature,  # PrimitiveField in generate_composite
        "warning_invalid_invoice_signature": m.warning_invalid_invoice_signature,  # PrimitiveField in generate_composite
        "warning_invalid_invreq_payer_note": m.warning_invalid_invreq_payer_note,  # PrimitiveField in generate_composite
        "warning_invalid_offer_currency": m.warning_invalid_offer_currency,  # PrimitiveField in generate_composite
        "warning_invalid_offer_description": m.warning_invalid_offer_description,  # PrimitiveField in generate_composite
        "warning_invalid_offer_issuer": m.warning_invalid_offer_issuer,  # PrimitiveField in generate_composite
        "warning_invreq_bip_353_name_domain_invalid": m.warning_invreq_bip_353_name_domain_invalid,  # PrimitiveField in generate_composite
        "warning_invreq_bip_353_name_name_invalid": m.warning_invreq_bip_353_name_name_invalid,  # PrimitiveField in generate_composite
        "warning_invreq_recurrence_cancel_with_zero_counter": m.warning_invreq_recurrence_cancel_with_zero_counter,  # PrimitiveField in generate_composite
        "warning_invreq_recurrence_cancel_without_counter": m.warning_invreq_recurrence_cancel_without_counter,  # PrimitiveField in generate_composite
        "warning_missing_invoice_amount": m.warning_missing_invoice_amount,  # PrimitiveField in generate_composite
        "warning_missing_invoice_blindedpay": m.warning_missing_invoice_blindedpay,  # PrimitiveField in generate_composite
        "warning_missing_invoice_created_at": m.warning_missing_invoice_created_at,  # PrimitiveField in generate_composite
        "warning_missing_invoice_node_id": m.warning_missing_invoice_node_id,  # PrimitiveField in generate_composite
        "warning_missing_invoice_paths": m.warning_missing_invoice_paths,  # PrimitiveField in generate_composite
        "warning_missing_invoice_payment_hash": m.warning_missing_invoice_payment_hash,  # PrimitiveField in generate_composite
        "warning_missing_invoice_recurrence_basetime": m.warning_missing_invoice_recurrence_basetime,  # PrimitiveField in generate_composite
        "warning_missing_invoice_request_signature": m.warning_missing_invoice_request_signature,  # PrimitiveField in generate_composite
        "warning_missing_invoice_signature": m.warning_missing_invoice_signature,  # PrimitiveField in generate_composite
        "warning_missing_invreq_metadata": m.warning_missing_invreq_metadata,  # PrimitiveField in generate_composite
        "warning_missing_invreq_payer_id": m.warning_missing_invreq_payer_id,  # PrimitiveField in generate_composite
        "warning_missing_offer_description": m.warning_missing_offer_description,  # PrimitiveField in generate_composite
        "warning_missing_offer_issuer_id": m.warning_missing_offer_issuer_id,  # PrimitiveField in generate_composite
        "warning_rune_invalid_utf8": m.warning_rune_invalid_utf8,  # PrimitiveField in generate_composite
        "warning_unknown_offer_currency": m.warning_unknown_offer_currency,  # PrimitiveField in generate_composite
    })


def delpay_payments2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "completed_at": m.completed_at,  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "erroronion": hexlify(m.erroronion),  # PrimitiveField in generate_composite
        "groupid": m.groupid,  # PrimitiveField in generate_composite
        "id": m.id,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "partid": m.partid,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def delpay2py(m):
    return remove_default({
        "payments": [delpay_payments2py(i) for i in m.payments],  # ArrayField[composite] in generate_composite
    })


def delforward2py(m):
    return remove_default({
    })


def disableoffer2py(m):
    return remove_default({
        "active": m.active,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "force_paths": m.force_paths,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "offer_id": hexlify(m.offer_id),  # PrimitiveField in generate_composite
        "single_use": m.single_use,  # PrimitiveField in generate_composite
        "used": m.used,  # PrimitiveField in generate_composite
    })


def enableoffer2py(m):
    return remove_default({
        "active": m.active,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "force_paths": m.force_paths,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "offer_id": hexlify(m.offer_id),  # PrimitiveField in generate_composite
        "single_use": m.single_use,  # PrimitiveField in generate_composite
        "used": m.used,  # PrimitiveField in generate_composite
    })


def disconnect2py(m):
    return remove_default({
    })


def feerates_onchain_fee_estimates2py(m):
    return remove_default({
        "htlc_success_satoshis": m.htlc_success_satoshis,  # PrimitiveField in generate_composite
        "htlc_timeout_satoshis": m.htlc_timeout_satoshis,  # PrimitiveField in generate_composite
        "mutual_close_satoshis": m.mutual_close_satoshis,  # PrimitiveField in generate_composite
        "opening_channel_satoshis": m.opening_channel_satoshis,  # PrimitiveField in generate_composite
        "unilateral_close_nonanchor_satoshis": m.unilateral_close_nonanchor_satoshis,  # PrimitiveField in generate_composite
        "unilateral_close_satoshis": m.unilateral_close_satoshis,  # PrimitiveField in generate_composite
    })


def feerates_perkb_estimates2py(m):
    return remove_default({
        "blockcount": m.blockcount,  # PrimitiveField in generate_composite
        "feerate": m.feerate,  # PrimitiveField in generate_composite
        "smoothed_feerate": m.smoothed_feerate,  # PrimitiveField in generate_composite
    })


def feerates_perkb2py(m):
    return remove_default({
        "estimates": [feerates_perkb_estimates2py(i) for i in m.estimates],  # ArrayField[composite] in generate_composite
        "floor": m.floor,  # PrimitiveField in generate_composite
        "max_acceptable": m.max_acceptable,  # PrimitiveField in generate_composite
        "min_acceptable": m.min_acceptable,  # PrimitiveField in generate_composite
        "mutual_close": m.mutual_close,  # PrimitiveField in generate_composite
        "opening": m.opening,  # PrimitiveField in generate_composite
        "penalty": m.penalty,  # PrimitiveField in generate_composite
        "splice": m.splice,  # PrimitiveField in generate_composite
        "unilateral_anchor_close": m.unilateral_anchor_close,  # PrimitiveField in generate_composite
        "unilateral_close": m.unilateral_close,  # PrimitiveField in generate_composite
    })


def feerates_perkw_estimates2py(m):
    return remove_default({
        "blockcount": m.blockcount,  # PrimitiveField in generate_composite
        "feerate": m.feerate,  # PrimitiveField in generate_composite
        "smoothed_feerate": m.smoothed_feerate,  # PrimitiveField in generate_composite
    })


def feerates_perkw2py(m):
    return remove_default({
        "estimates": [feerates_perkw_estimates2py(i) for i in m.estimates],  # ArrayField[composite] in generate_composite
        "floor": m.floor,  # PrimitiveField in generate_composite
        "max_acceptable": m.max_acceptable,  # PrimitiveField in generate_composite
        "min_acceptable": m.min_acceptable,  # PrimitiveField in generate_composite
        "mutual_close": m.mutual_close,  # PrimitiveField in generate_composite
        "opening": m.opening,  # PrimitiveField in generate_composite
        "penalty": m.penalty,  # PrimitiveField in generate_composite
        "splice": m.splice,  # PrimitiveField in generate_composite
        "unilateral_anchor_close": m.unilateral_anchor_close,  # PrimitiveField in generate_composite
        "unilateral_close": m.unilateral_close,  # PrimitiveField in generate_composite
    })


def feerates2py(m):
    return remove_default({
        "warning_missing_feerates": m.warning_missing_feerates,  # PrimitiveField in generate_composite
    })


def fetchbip353_instructions2py(m):
    return remove_default({
        "description": m.description,  # PrimitiveField in generate_composite
        "offchain_amount_msat": m.offchain_amount_msat,  # PrimitiveField in generate_composite
        "offer": m.offer,  # PrimitiveField in generate_composite
        "onchain": m.onchain,  # PrimitiveField in generate_composite
        "onchain_amount_sat": m.onchain_amount_sat,  # PrimitiveField in generate_composite
    })


def fetchbip3532py(m):
    return remove_default({
        "instructions": [fetchbip353_instructions2py(i) for i in m.instructions],  # ArrayField[composite] in generate_composite
        "proof": m.proof,  # PrimitiveField in generate_composite
    })


def fetchinvoice_changes2py(m):
    return remove_default({
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "description_appended": m.description_appended,  # PrimitiveField in generate_composite
        "vendor": m.vendor,  # PrimitiveField in generate_composite
        "vendor_removed": m.vendor_removed,  # PrimitiveField in generate_composite
    })


def fetchinvoice_next_period2py(m):
    return remove_default({
        "counter": m.counter,  # PrimitiveField in generate_composite
        "endtime": m.endtime,  # PrimitiveField in generate_composite
        "paywindow_end": m.paywindow_end,  # PrimitiveField in generate_composite
        "paywindow_start": m.paywindow_start,  # PrimitiveField in generate_composite
        "starttime": m.starttime,  # PrimitiveField in generate_composite
    })


def fetchinvoice2py(m):
    return remove_default({
        "invoice": m.invoice,  # PrimitiveField in generate_composite
    })


def cancelrecurringinvoice2py(m):
    return remove_default({
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
    })


def fundchannel_cancel2py(m):
    return remove_default({
        "cancelled": m.cancelled,  # PrimitiveField in generate_composite
    })


def fundchannel_complete2py(m):
    return remove_default({
        "channel_id": hexlify(m.channel_id),  # PrimitiveField in generate_composite
        "commitments_secured": m.commitments_secured,  # PrimitiveField in generate_composite
    })


def fundchannel_channel_type2py(m):
    return remove_default({
        "bits": [m.bits for i in m.bits], # ArrayField[primitive] in generate_composite
        "names": [str(i) for i in m.names],  # ArrayField[composite] in generate_composite
    })


def fundchannel2py(m):
    return remove_default({
        "channel_id": hexlify(m.channel_id),  # PrimitiveField in generate_composite
        "close_to": hexlify(m.close_to),  # PrimitiveField in generate_composite
        "mindepth": m.mindepth,  # PrimitiveField in generate_composite
        "outnum": m.outnum,  # PrimitiveField in generate_composite
        "tx": hexlify(m.tx),  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def fundchannel_start_channel_type2py(m):
    return remove_default({
        "bits": [m.bits for i in m.bits], # ArrayField[primitive] in generate_composite
        "names": [str(i) for i in m.names],  # ArrayField[composite] in generate_composite
    })


def fundchannel_start2py(m):
    return remove_default({
        "close_to": hexlify(m.close_to),  # PrimitiveField in generate_composite
        "funding_address": m.funding_address,  # PrimitiveField in generate_composite
        "mindepth": m.mindepth,  # PrimitiveField in generate_composite
        "scriptpubkey": hexlify(m.scriptpubkey),  # PrimitiveField in generate_composite
        "warning_usage": m.warning_usage,  # PrimitiveField in generate_composite
    })


def getlog_log2py(m):
    return remove_default({
        "type": str(m.item_type),  # EnumField in generate_composite
        "data": hexlify(m.data),  # PrimitiveField in generate_composite
        "log": m.log,  # PrimitiveField in generate_composite
        "node_id": hexlify(m.node_id),  # PrimitiveField in generate_composite
        "num_skipped": m.num_skipped,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
        "time": m.time,  # PrimitiveField in generate_composite
    })


def getlog2py(m):
    return remove_default({
        "log": [getlog_log2py(i) for i in m.log],  # ArrayField[composite] in generate_composite
        "bytes_max": m.bytes_max,  # PrimitiveField in generate_composite
        "bytes_used": m.bytes_used,  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
    })


def funderupdate2py(m):
    return remove_default({
        "policy": str(m.policy),  # EnumField in generate_composite
        "channel_fee_max_base_msat": amount2msat(m.channel_fee_max_base_msat),  # PrimitiveField in generate_composite
        "channel_fee_max_proportional_thousandths": m.channel_fee_max_proportional_thousandths,  # PrimitiveField in generate_composite
        "compact_lease": hexlify(m.compact_lease),  # PrimitiveField in generate_composite
        "fund_probability": m.fund_probability,  # PrimitiveField in generate_composite
        "funding_weight": m.funding_weight,  # PrimitiveField in generate_composite
        "fuzz_percent": m.fuzz_percent,  # PrimitiveField in generate_composite
        "lease_fee_base_msat": amount2msat(m.lease_fee_base_msat),  # PrimitiveField in generate_composite
        "lease_fee_basis": m.lease_fee_basis,  # PrimitiveField in generate_composite
        "leases_only": m.leases_only,  # PrimitiveField in generate_composite
        "max_their_funding_msat": amount2msat(m.max_their_funding_msat),  # PrimitiveField in generate_composite
        "min_their_funding_msat": amount2msat(m.min_their_funding_msat),  # PrimitiveField in generate_composite
        "per_channel_max_msat": amount2msat(m.per_channel_max_msat),  # PrimitiveField in generate_composite
        "per_channel_min_msat": amount2msat(m.per_channel_min_msat),  # PrimitiveField in generate_composite
        "policy_mod": m.policy_mod,  # PrimitiveField in generate_composite
        "reserve_tank_msat": amount2msat(m.reserve_tank_msat),  # PrimitiveField in generate_composite
        "summary": m.summary,  # PrimitiveField in generate_composite
    })


def getroute_route2py(m):
    return remove_default({
        "style": str(m.style),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "channel": m.channel,  # PrimitiveField in generate_composite
        "delay": m.delay,  # PrimitiveField in generate_composite
        "direction": m.direction,  # PrimitiveField in generate_composite
        "id": hexlify(m.id),  # PrimitiveField in generate_composite
    })


def getroute2py(m):
    return remove_default({
        "route": [getroute_route2py(i) for i in m.route],  # ArrayField[composite] in generate_composite
    })


def listaddresses_addresses2py(m):
    return remove_default({
        "bech32": m.bech32,  # PrimitiveField in generate_composite
        "keyidx": m.keyidx,  # PrimitiveField in generate_composite
        "p2tr": m.p2tr,  # PrimitiveField in generate_composite
    })


def listaddresses2py(m):
    return remove_default({
        "addresses": [listaddresses_addresses2py(i) for i in m.addresses],  # ArrayField[composite] in generate_composite
    })


def listforwards_forwards2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "style": str(m.style),  # EnumField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "failcode": m.failcode,  # PrimitiveField in generate_composite
        "failreason": m.failreason,  # PrimitiveField in generate_composite
        "fee_msat": amount2msat(m.fee_msat),  # PrimitiveField in generate_composite
        "in_channel": m.in_channel,  # PrimitiveField in generate_composite
        "in_htlc_id": m.in_htlc_id,  # PrimitiveField in generate_composite
        "in_msat": amount2msat(m.in_msat),  # PrimitiveField in generate_composite
        "out_channel": m.out_channel,  # PrimitiveField in generate_composite
        "out_htlc_id": m.out_htlc_id,  # PrimitiveField in generate_composite
        "out_msat": amount2msat(m.out_msat),  # PrimitiveField in generate_composite
        "received_time": m.received_time,  # PrimitiveField in generate_composite
        "resolved_time": m.resolved_time,  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def listforwards2py(m):
    return remove_default({
        "forwards": [listforwards_forwards2py(i) for i in m.forwards],  # ArrayField[composite] in generate_composite
    })


def listoffers_offers2py(m):
    return remove_default({
        "active": m.active,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "force_paths": m.force_paths,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "offer_id": hexlify(m.offer_id),  # PrimitiveField in generate_composite
        "single_use": m.single_use,  # PrimitiveField in generate_composite
        "used": m.used,  # PrimitiveField in generate_composite
    })


def listoffers2py(m):
    return remove_default({
        "offers": [listoffers_offers2py(i) for i in m.offers],  # ArrayField[composite] in generate_composite
    })


def listpays_pays2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "completed_at": m.completed_at,  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "erroronion": hexlify(m.erroronion),  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "number_of_parts": m.number_of_parts,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "preimage": hexlify(m.preimage),  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def listpays2py(m):
    return remove_default({
        "pays": [listpays_pays2py(i) for i in m.pays],  # ArrayField[composite] in generate_composite
    })


def listhtlcs_htlcs2py(m):
    return remove_default({
        "direction": str(m.direction),  # EnumField in generate_composite
        "state": str(m.state),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "expiry": m.expiry,  # PrimitiveField in generate_composite
        "id": m.id,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "short_channel_id": m.short_channel_id,  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def listhtlcs2py(m):
    return remove_default({
        "htlcs": [listhtlcs_htlcs2py(i) for i in m.htlcs],  # ArrayField[composite] in generate_composite
    })


def multifundchannel_channel_ids_channel_type2py(m):
    return remove_default({
        "bits": [m.bits for i in m.bits], # ArrayField[primitive] in generate_composite
        "names": [str(i) for i in m.names],  # ArrayField[composite] in generate_composite
    })


def multifundchannel_channel_ids2py(m):
    return remove_default({
        "channel_id": hexlify(m.channel_id),  # PrimitiveField in generate_composite
        "close_to": hexlify(m.close_to),  # PrimitiveField in generate_composite
        "id": hexlify(m.id),  # PrimitiveField in generate_composite
        "outnum": m.outnum,  # PrimitiveField in generate_composite
    })


def multifundchannel_failed_error2py(m):
    return remove_default({
        "code": m.code,  # PrimitiveField in generate_composite
        "message": m.message,  # PrimitiveField in generate_composite
    })


def multifundchannel_failed2py(m):
    return remove_default({
        "method": str(m.method),  # EnumField in generate_composite
        "id": hexlify(m.id),  # PrimitiveField in generate_composite
    })


def multifundchannel2py(m):
    return remove_default({
        "channel_ids": [multifundchannel_channel_ids2py(i) for i in m.channel_ids],  # ArrayField[composite] in generate_composite
        "failed": [multifundchannel_failed2py(i) for i in m.failed],  # ArrayField[composite] in generate_composite
        "tx": hexlify(m.tx),  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def multiwithdraw2py(m):
    return remove_default({
        "tx": hexlify(m.tx),  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def offer2py(m):
    return remove_default({
        "active": m.active,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "created": m.created,  # PrimitiveField in generate_composite
        "force_paths": m.force_paths,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "offer_id": hexlify(m.offer_id),  # PrimitiveField in generate_composite
        "single_use": m.single_use,  # PrimitiveField in generate_composite
        "used": m.used,  # PrimitiveField in generate_composite
    })


def openchannel_abort2py(m):
    return remove_default({
        "channel_canceled": m.channel_canceled,  # PrimitiveField in generate_composite
        "channel_id": hexlify(m.channel_id),  # PrimitiveField in generate_composite
        "reason": m.reason,  # PrimitiveField in generate_composite
    })


def openchannel_bump_channel_type2py(m):
    return remove_default({
        "bits": [m.bits for i in m.bits], # ArrayField[primitive] in generate_composite
        "names": [str(i) for i in m.names],  # ArrayField[composite] in generate_composite
    })


def openchannel_bump2py(m):
    return remove_default({
        "channel_id": hexlify(m.channel_id),  # PrimitiveField in generate_composite
        "commitments_secured": m.commitments_secured,  # PrimitiveField in generate_composite
        "funding_serial": m.funding_serial,  # PrimitiveField in generate_composite
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "requires_confirmed_inputs": m.requires_confirmed_inputs,  # PrimitiveField in generate_composite
    })


def openchannel_init_channel_type2py(m):
    return remove_default({
        "bits": [m.bits for i in m.bits], # ArrayField[primitive] in generate_composite
        "names": [str(i) for i in m.names],  # ArrayField[composite] in generate_composite
    })


def openchannel_init2py(m):
    return remove_default({
        "channel_id": hexlify(m.channel_id),  # PrimitiveField in generate_composite
        "commitments_secured": m.commitments_secured,  # PrimitiveField in generate_composite
        "funding_serial": m.funding_serial,  # PrimitiveField in generate_composite
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "requires_confirmed_inputs": m.requires_confirmed_inputs,  # PrimitiveField in generate_composite
    })


def openchannel_signed2py(m):
    return remove_default({
        "channel_id": hexlify(m.channel_id),  # PrimitiveField in generate_composite
        "tx": hexlify(m.tx),  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def openchannel_update_channel_type2py(m):
    return remove_default({
        "bits": [m.bits for i in m.bits], # ArrayField[primitive] in generate_composite
        "names": [str(i) for i in m.names],  # ArrayField[composite] in generate_composite
    })


def openchannel_update2py(m):
    return remove_default({
        "channel_id": hexlify(m.channel_id),  # PrimitiveField in generate_composite
        "close_to": hexlify(m.close_to),  # PrimitiveField in generate_composite
        "commitments_secured": m.commitments_secured,  # PrimitiveField in generate_composite
        "funding_outnum": m.funding_outnum,  # PrimitiveField in generate_composite
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "requires_confirmed_inputs": m.requires_confirmed_inputs,  # PrimitiveField in generate_composite
    })


def ping2py(m):
    return remove_default({
        "totlen": m.totlen,  # PrimitiveField in generate_composite
    })


def plugin_plugins2py(m):
    return remove_default({
        "active": m.active,  # PrimitiveField in generate_composite
        "dynamic": m.dynamic,  # PrimitiveField in generate_composite
        "name": m.name,  # PrimitiveField in generate_composite
    })


def plugin2py(m):
    return remove_default({
        "command": str(m.command),  # EnumField in generate_composite
        "plugins": [plugin_plugins2py(i) for i in m.plugins],  # ArrayField[composite] in generate_composite
        "result": m.result,  # PrimitiveField in generate_composite
    })


def renepaystatus_paystatus2py(m):
    return remove_default({
        "notes": [m.notes for i in m.notes], # ArrayField[primitive] in generate_composite
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "groupid": m.groupid,  # PrimitiveField in generate_composite
        "parts": m.parts,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
    })


def renepaystatus2py(m):
    return remove_default({
        "paystatus": [renepaystatus_paystatus2py(i) for i in m.paystatus],  # ArrayField[composite] in generate_composite
    })


def renepay2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "groupid": m.groupid,  # PrimitiveField in generate_composite
        "parts": m.parts,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
    })


def reserveinputs_reservations2py(m):
    return remove_default({
        "reserved": m.reserved,  # PrimitiveField in generate_composite
        "reserved_to_block": m.reserved_to_block,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
        "vout": m.vout,  # PrimitiveField in generate_composite
        "was_reserved": m.was_reserved,  # PrimitiveField in generate_composite
    })


def reserveinputs2py(m):
    return remove_default({
        "reservations": [reserveinputs_reservations2py(i) for i in m.reservations],  # ArrayField[composite] in generate_composite
    })


def sendcustommsg2py(m):
    return remove_default({
        "status": m.status,  # PrimitiveField in generate_composite
    })


def sendinvoice2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_received_msat": amount2msat(m.amount_received_msat),  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "expires_at": m.expires_at,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "paid_at": m.paid_at,  # PrimitiveField in generate_composite
        "pay_index": m.pay_index,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "updated_index": m.updated_index,  # PrimitiveField in generate_composite
    })


def setchannel_channels2py(m):
    return remove_default({
        "channel_id": hexlify(m.channel_id),  # PrimitiveField in generate_composite
        "fee_base_msat": amount2msat(m.fee_base_msat),  # PrimitiveField in generate_composite
        "fee_proportional_millionths": m.fee_proportional_millionths,  # PrimitiveField in generate_composite
        "ignore_fee_limits": m.ignore_fee_limits,  # PrimitiveField in generate_composite
        "maximum_htlc_out_msat": amount2msat(m.maximum_htlc_out_msat),  # PrimitiveField in generate_composite
        "minimum_htlc_out_msat": amount2msat(m.minimum_htlc_out_msat),  # PrimitiveField in generate_composite
        "peer_id": hexlify(m.peer_id),  # PrimitiveField in generate_composite
        "short_channel_id": m.short_channel_id,  # PrimitiveField in generate_composite
        "warning_htlcmax_too_high": m.warning_htlcmax_too_high,  # PrimitiveField in generate_composite
        "warning_htlcmin_too_low": m.warning_htlcmin_too_low,  # PrimitiveField in generate_composite
    })


def setchannel2py(m):
    return remove_default({
        "channels": [setchannel_channels2py(i) for i in m.channels],  # ArrayField[composite] in generate_composite
    })


def setconfig_config2py(m):
    return remove_default({
        "sources": [m.sources for i in m.sources], # ArrayField[primitive] in generate_composite
        "values_str": [m.values_str for i in m.values_str], # ArrayField[primitive] in generate_composite
        "config": m.config,  # PrimitiveField in generate_composite
        "dynamic": m.dynamic,  # PrimitiveField in generate_composite
        "plugin": m.plugin,  # PrimitiveField in generate_composite
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
        "value_bool": m.value_bool,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
        "value_msat": amount2msat(m.value_msat),  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def setconfig2py(m):
    return remove_default({
    })


def setpsbtversion2py(m):
    return remove_default({
        "psbt": m.psbt,  # PrimitiveField in generate_composite
    })


def signinvoice2py(m):
    return remove_default({
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
    })


def signmessage2py(m):
    return remove_default({
        "recid": hexlify(m.recid),  # PrimitiveField in generate_composite
        "signature": hexlify(m.signature),  # PrimitiveField in generate_composite
        "zbase": m.zbase,  # PrimitiveField in generate_composite
    })


def splice_init2py(m):
    return remove_default({
        "psbt": m.psbt,  # PrimitiveField in generate_composite
    })


def splice_signed2py(m):
    return remove_default({
        "outnum": m.outnum,  # PrimitiveField in generate_composite
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "tx": hexlify(m.tx),  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def splice_update2py(m):
    return remove_default({
        "commitments_secured": m.commitments_secured,  # PrimitiveField in generate_composite
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "signatures_secured": m.signatures_secured,  # PrimitiveField in generate_composite
    })


def splicein2py(m):
    return remove_default({
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "tx": m.tx,  # PrimitiveField in generate_composite
        "txid": m.txid,  # PrimitiveField in generate_composite
    })


def spliceout2py(m):
    return remove_default({
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "tx": m.tx,  # PrimitiveField in generate_composite
        "txid": m.txid,  # PrimitiveField in generate_composite
    })


def dev_splice2py(m):
    return remove_default({
        "dryrun": [m.dryrun for i in m.dryrun], # ArrayField[primitive] in generate_composite
        "log": [m.log for i in m.log], # ArrayField[primitive] in generate_composite
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "tx": m.tx,  # PrimitiveField in generate_composite
        "txid": m.txid,  # PrimitiveField in generate_composite
    })


def unreserveinputs_reservations2py(m):
    return remove_default({
        "reserved": m.reserved,  # PrimitiveField in generate_composite
        "reserved_to_block": m.reserved_to_block,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
        "vout": m.vout,  # PrimitiveField in generate_composite
        "was_reserved": m.was_reserved,  # PrimitiveField in generate_composite
    })


def unreserveinputs2py(m):
    return remove_default({
        "reservations": [unreserveinputs_reservations2py(i) for i in m.reservations],  # ArrayField[composite] in generate_composite
    })


def upgradewallet2py(m):
    return remove_default({
        "psbt": m.psbt,  # PrimitiveField in generate_composite
        "tx": hexlify(m.tx),  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
        "upgraded_outs": m.upgraded_outs,  # PrimitiveField in generate_composite
    })


def waitblockheight2py(m):
    return remove_default({
        "blockheight": m.blockheight,  # PrimitiveField in generate_composite
    })


def wait_chainmoves2py(m):
    return remove_default({
        "account": m.account,  # PrimitiveField in generate_composite
        "credit_msat": amount2msat(m.credit_msat),  # PrimitiveField in generate_composite
        "debit_msat": amount2msat(m.debit_msat),  # PrimitiveField in generate_composite
    })


def wait_channelmoves2py(m):
    return remove_default({
        "account": m.account,  # PrimitiveField in generate_composite
        "credit_msat": amount2msat(m.credit_msat),  # PrimitiveField in generate_composite
        "debit_msat": amount2msat(m.debit_msat),  # PrimitiveField in generate_composite
    })


def wait_details2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "groupid": m.groupid,  # PrimitiveField in generate_composite
        "in_channel": m.in_channel,  # PrimitiveField in generate_composite
        "in_htlc_id": m.in_htlc_id,  # PrimitiveField in generate_composite
        "in_msat": amount2msat(m.in_msat),  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
        "out_channel": m.out_channel,  # PrimitiveField in generate_composite
        "partid": m.partid,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
    })


def wait_forwards2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "in_channel": m.in_channel,  # PrimitiveField in generate_composite
        "in_htlc_id": m.in_htlc_id,  # PrimitiveField in generate_composite
        "in_msat": amount2msat(m.in_msat),  # PrimitiveField in generate_composite
        "out_channel": m.out_channel,  # PrimitiveField in generate_composite
    })


def wait_htlcs2py(m):
    return remove_default({
        "direction": str(m.direction),  # EnumField in generate_composite
        "state": str(m.state),  # EnumField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "cltv_expiry": m.cltv_expiry,  # PrimitiveField in generate_composite
        "htlc_id": m.htlc_id,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "short_channel_id": m.short_channel_id,  # PrimitiveField in generate_composite
    })


def wait_invoices2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "bolt11": m.bolt11,  # PrimitiveField in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "label": m.label,  # PrimitiveField in generate_composite
    })


def wait_networkevents2py(m):
    return remove_default({
        "type": str(m.item_type),  # EnumField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "peer_id": hexlify(m.peer_id),  # PrimitiveField in generate_composite
    })


def wait_sendpays2py(m):
    return remove_default({
        "status": str(m.status),  # EnumField in generate_composite
        "groupid": m.groupid,  # PrimitiveField in generate_composite
        "partid": m.partid,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
    })


def wait2py(m):
    return remove_default({
        "subsystem": str(m.subsystem),  # EnumField in generate_composite
        "created": m.created,  # PrimitiveField in generate_composite
        "deleted": m.deleted,  # PrimitiveField in generate_composite
        "updated": m.updated,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_addr2py(m):
    return remove_default({
        "sources": [m.sources for i in m.sources], # ArrayField[primitive] in generate_composite
        "values_str": [m.values_str for i in m.values_str], # ArrayField[primitive] in generate_composite
    })


def listconfigs_configs_alias2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_allow_deprecated_apis2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_bool": m.value_bool,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_always_use_proxy2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_bool": m.value_bool,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_announce_addr2py(m):
    return remove_default({
        "sources": [m.sources for i in m.sources], # ArrayField[primitive] in generate_composite
        "values_str": [m.values_str for i in m.values_str], # ArrayField[primitive] in generate_composite
    })


def listconfigs_configs_announce_addr_discovered2py(m):
    return remove_default({
        "value_str": str(m.value_str),  # EnumField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_announce_addr_discovered_port2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_announce_addr_dns2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_bool": m.value_bool,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_autoconnect_seeker_peers2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_autolisten2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_bool": m.value_bool,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_bind_addr2py(m):
    return remove_default({
        "sources": [m.sources for i in m.sources], # ArrayField[primitive] in generate_composite
        "values_str": [m.values_str for i in m.values_str], # ArrayField[primitive] in generate_composite
    })


def listconfigs_configs_clear_plugins2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_cltv_delta2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_cltv_final2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_commit_fee2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_commit_feerate_offset2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_commit_time2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_conf2py(m):
    return remove_default({
        "source": str(m.source),  # EnumField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_currencyrate_add_source2py(m):
    return remove_default({
        "sources": [m.sources for i in m.sources], # ArrayField[primitive] in generate_composite
        "values_str": [m.values_str for i in m.values_str], # ArrayField[primitive] in generate_composite
        "plugin": m.plugin,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_currencyrate_disable_source2py(m):
    return remove_default({
        "sources": [m.sources for i in m.sources], # ArrayField[primitive] in generate_composite
        "values_str": [m.values_str for i in m.values_str], # ArrayField[primitive] in generate_composite
        "plugin": m.plugin,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_daemon2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_database_upgrade2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_bool": m.value_bool,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_developer2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_disable_dns2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_disable_mpp2py(m):
    return remove_default({
        "plugin": m.plugin,  # PrimitiveField in generate_composite
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_disable_plugin2py(m):
    return remove_default({
        "sources": [m.sources for i in m.sources], # ArrayField[primitive] in generate_composite
        "values_str": [m.values_str for i in m.values_str], # ArrayField[primitive] in generate_composite
    })


def listconfigs_configs_encrypted_hsm2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_experimental_anchors2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_experimental_dual_fund2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_experimental_peer_storage2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_experimental_shutdown_wrong_funding2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_experimental_splicing2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_fee_base2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_fee_per_satoshi2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_fetchinvoice_noconnect2py(m):
    return remove_default({
        "plugin": m.plugin,  # PrimitiveField in generate_composite
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_force_feerates2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_funding_confirms2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_htlc_maximum_msat2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_msat": amount2msat(m.value_msat),  # PrimitiveField in generate_composite
    })


def listconfigs_configs_htlc_minimum_msat2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_msat": amount2msat(m.value_msat),  # PrimitiveField in generate_composite
    })


def listconfigs_configs_ignore_fee_limits2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_bool": m.value_bool,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_important_plugin2py(m):
    return remove_default({
        "sources": [m.sources for i in m.sources], # ArrayField[primitive] in generate_composite
        "values_str": [m.values_str for i in m.values_str], # ArrayField[primitive] in generate_composite
    })


def listconfigs_configs_large_channels2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_lightning_dir2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_log_file2py(m):
    return remove_default({
        "sources": [m.sources for i in m.sources], # ArrayField[primitive] in generate_composite
        "values_str": [m.values_str for i in m.values_str], # ArrayField[primitive] in generate_composite
    })


def listconfigs_configs_log_level2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_log_prefix2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_log_timestamps2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_bool": m.value_bool,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_mainnet2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_max_concurrent_htlcs2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_max_dust_htlc_exposure_msat2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_msat": amount2msat(m.value_msat),  # PrimitiveField in generate_composite
    })


def listconfigs_configs_min_capacity_sat2py(m):
    return remove_default({
        "dynamic": m.dynamic,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_network2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_offline2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_pid_file2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_plugin2py(m):
    return remove_default({
        "sources": [m.sources for i in m.sources], # ArrayField[primitive] in generate_composite
        "values_str": [m.values_str for i in m.values_str], # ArrayField[primitive] in generate_composite
    })


def listconfigs_configs_plugin_dir2py(m):
    return remove_default({
        "sources": [m.sources for i in m.sources], # ArrayField[primitive] in generate_composite
        "values_str": [m.values_str for i in m.values_str], # ArrayField[primitive] in generate_composite
    })


def listconfigs_configs_proxy2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_regtest2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_require_confirmed_inputs2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_bool": m.value_bool,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_rescan2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_rgb2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": hexlify(m.value_str),  # PrimitiveField in generate_composite
    })


def listconfigs_configs_rpc_file2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_rpc_file_mode2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_signet2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_subdaemon2py(m):
    return remove_default({
        "sources": [m.sources for i in m.sources], # ArrayField[primitive] in generate_composite
        "values_str": [m.values_str for i in m.values_str], # ArrayField[primitive] in generate_composite
    })


def listconfigs_configs_testnet2py(m):
    return remove_default({
        "set": m.set,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_tor_service_password2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_wallet2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_str": m.value_str,  # PrimitiveField in generate_composite
    })


def listconfigs_configs_watchtime_blocks2py(m):
    return remove_default({
        "source": m.source,  # PrimitiveField in generate_composite
        "value_int": m.value_int,  # PrimitiveField in generate_composite
    })


def listconfigs_configs2py(m):
    return remove_default({
    })


def listconfigs2py(m):
    return remove_default({
    })


def stop2py(m):
    return remove_default({
        "result": str(m.result),  # EnumField in generate_composite
    })


def help_help2py(m):
    return remove_default({
        "command": m.command,  # PrimitiveField in generate_composite
    })


def help2py(m):
    return remove_default({
        "format-hint": str(m.format_hint),  # EnumField in generate_composite
        "help": [help_help2py(i) for i in m.help],  # ArrayField[composite] in generate_composite
    })


def preapprovekeysend2py(m):
    return remove_default({
    })


def preapproveinvoice2py(m):
    return remove_default({
    })


def staticbackup2py(m):
    return remove_default({
        "scb": [hexlify(m.scb) for i in hexlify(m.scb)], # ArrayField[primitive] in generate_composite
    })


def bkpr_channelsapy_channels_apy2py(m):
    return remove_default({
        "account": m.account,  # PrimitiveField in generate_composite
        "apy_in": m.apy_in,  # PrimitiveField in generate_composite
        "apy_in_initial": m.apy_in_initial,  # PrimitiveField in generate_composite
        "apy_lease": m.apy_lease,  # PrimitiveField in generate_composite
        "apy_out": m.apy_out,  # PrimitiveField in generate_composite
        "apy_out_initial": m.apy_out_initial,  # PrimitiveField in generate_composite
        "apy_total": m.apy_total,  # PrimitiveField in generate_composite
        "apy_total_initial": m.apy_total_initial,  # PrimitiveField in generate_composite
        "channel_start_balance_msat": amount2msat(m.channel_start_balance_msat),  # PrimitiveField in generate_composite
        "fees_in_msat": amount2msat(m.fees_in_msat),  # PrimitiveField in generate_composite
        "fees_out_msat": amount2msat(m.fees_out_msat),  # PrimitiveField in generate_composite
        "lease_fee_earned_msat": amount2msat(m.lease_fee_earned_msat),  # PrimitiveField in generate_composite
        "lease_fee_paid_msat": amount2msat(m.lease_fee_paid_msat),  # PrimitiveField in generate_composite
        "our_start_balance_msat": amount2msat(m.our_start_balance_msat),  # PrimitiveField in generate_composite
        "pushed_in_msat": amount2msat(m.pushed_in_msat),  # PrimitiveField in generate_composite
        "pushed_out_msat": amount2msat(m.pushed_out_msat),  # PrimitiveField in generate_composite
        "routed_in_msat": amount2msat(m.routed_in_msat),  # PrimitiveField in generate_composite
        "routed_out_msat": amount2msat(m.routed_out_msat),  # PrimitiveField in generate_composite
        "utilization_in": m.utilization_in,  # PrimitiveField in generate_composite
        "utilization_in_initial": m.utilization_in_initial,  # PrimitiveField in generate_composite
        "utilization_out": m.utilization_out,  # PrimitiveField in generate_composite
        "utilization_out_initial": m.utilization_out_initial,  # PrimitiveField in generate_composite
    })


def bkpr_channelsapy2py(m):
    return remove_default({
        "channels_apy": [bkpr_channelsapy_channels_apy2py(i) for i in m.channels_apy],  # ArrayField[composite] in generate_composite
    })


def bkpr_dumpincomecsv2py(m):
    return remove_default({
        "csv_format": str(m.csv_format),  # EnumField in generate_composite
        "csv_file": m.csv_file,  # PrimitiveField in generate_composite
    })


def bkpr_inspect_txs_outputs2py(m):
    return remove_default({
        "account": m.account,  # PrimitiveField in generate_composite
        "credit_msat": amount2msat(m.credit_msat),  # PrimitiveField in generate_composite
        "currency": m.currency,  # PrimitiveField in generate_composite
        "debit_msat": amount2msat(m.debit_msat),  # PrimitiveField in generate_composite
        "originating_account": m.originating_account,  # PrimitiveField in generate_composite
        "outnum": m.outnum,  # PrimitiveField in generate_composite
        "output_tag": m.output_tag,  # PrimitiveField in generate_composite
        "output_value_msat": amount2msat(m.output_value_msat),  # PrimitiveField in generate_composite
        "payment_id": hexlify(m.payment_id),  # PrimitiveField in generate_composite
        "spend_tag": m.spend_tag,  # PrimitiveField in generate_composite
        "spending_txid": hexlify(m.spending_txid),  # PrimitiveField in generate_composite
    })


def bkpr_inspect_txs2py(m):
    return remove_default({
        "outputs": [bkpr_inspect_txs_outputs2py(i) for i in m.outputs],  # ArrayField[composite] in generate_composite
        "blockheight": m.blockheight,  # PrimitiveField in generate_composite
        "fees_paid_msat": amount2msat(m.fees_paid_msat),  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def bkpr_inspect2py(m):
    return remove_default({
        "txs": [bkpr_inspect_txs2py(i) for i in m.txs],  # ArrayField[composite] in generate_composite
    })


def bkpr_listaccountevents_events2py(m):
    return remove_default({
        "type": str(m.item_type),  # EnumField in generate_composite
        "account": m.account,  # PrimitiveField in generate_composite
        "blockheight": m.blockheight,  # PrimitiveField in generate_composite
        "credit_msat": amount2msat(m.credit_msat),  # PrimitiveField in generate_composite
        "currency": m.currency,  # PrimitiveField in generate_composite
        "currencyrate": m.currencyrate,  # PrimitiveField in generate_composite
        "debit_msat": amount2msat(m.debit_msat),  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "fees_msat": amount2msat(m.fees_msat),  # PrimitiveField in generate_composite
        "is_rebalance": m.is_rebalance,  # PrimitiveField in generate_composite
        "origin": m.origin,  # PrimitiveField in generate_composite
        "outpoint": m.outpoint,  # PrimitiveField in generate_composite
        "part_id": m.part_id,  # PrimitiveField in generate_composite
        "payment_id": hexlify(m.payment_id),  # PrimitiveField in generate_composite
        "tag": m.tag,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def bkpr_listaccountevents2py(m):
    return remove_default({
        "events": [bkpr_listaccountevents_events2py(i) for i in m.events],  # ArrayField[composite] in generate_composite
    })


def bkpr_listbalances_accounts_balances2py(m):
    return remove_default({
        "balance_msat": amount2msat(m.balance_msat),  # PrimitiveField in generate_composite
        "coin_type": m.coin_type,  # PrimitiveField in generate_composite
    })


def bkpr_listbalances_accounts2py(m):
    return remove_default({
        "balances": [bkpr_listbalances_accounts_balances2py(i) for i in m.balances],  # ArrayField[composite] in generate_composite
        "account": m.account,  # PrimitiveField in generate_composite
        "account_closed": m.account_closed,  # PrimitiveField in generate_composite
        "account_resolved": m.account_resolved,  # PrimitiveField in generate_composite
        "peer_id": hexlify(m.peer_id),  # PrimitiveField in generate_composite
        "resolved_at_block": m.resolved_at_block,  # PrimitiveField in generate_composite
        "we_opened": m.we_opened,  # PrimitiveField in generate_composite
    })


def bkpr_listbalances2py(m):
    return remove_default({
        "accounts": [bkpr_listbalances_accounts2py(i) for i in m.accounts],  # ArrayField[composite] in generate_composite
    })


def bkpr_listincome_income_events2py(m):
    return remove_default({
        "account": m.account,  # PrimitiveField in generate_composite
        "credit_msat": amount2msat(m.credit_msat),  # PrimitiveField in generate_composite
        "currency": m.currency,  # PrimitiveField in generate_composite
        "debit_msat": amount2msat(m.debit_msat),  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "outpoint": m.outpoint,  # PrimitiveField in generate_composite
        "payment_id": hexlify(m.payment_id),  # PrimitiveField in generate_composite
        "tag": m.tag,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def bkpr_listincome2py(m):
    return remove_default({
        "income_events": [bkpr_listincome_income_events2py(i) for i in m.income_events],  # ArrayField[composite] in generate_composite
    })


def bkpr_editdescriptionbypaymentid_updated2py(m):
    return remove_default({
        "type": str(m.item_type),  # EnumField in generate_composite
        "account": m.account,  # PrimitiveField in generate_composite
        "blockheight": m.blockheight,  # PrimitiveField in generate_composite
        "credit_msat": amount2msat(m.credit_msat),  # PrimitiveField in generate_composite
        "currency": m.currency,  # PrimitiveField in generate_composite
        "debit_msat": amount2msat(m.debit_msat),  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "fees_msat": amount2msat(m.fees_msat),  # PrimitiveField in generate_composite
        "is_rebalance": m.is_rebalance,  # PrimitiveField in generate_composite
        "origin": m.origin,  # PrimitiveField in generate_composite
        "outpoint": m.outpoint,  # PrimitiveField in generate_composite
        "part_id": m.part_id,  # PrimitiveField in generate_composite
        "payment_id": hexlify(m.payment_id),  # PrimitiveField in generate_composite
        "tag": m.tag,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def bkpr_editdescriptionbypaymentid2py(m):
    return remove_default({
        "updated": [bkpr_editdescriptionbypaymentid_updated2py(i) for i in m.updated],  # ArrayField[composite] in generate_composite
    })


def bkpr_editdescriptionbyoutpoint_updated2py(m):
    return remove_default({
        "type": str(m.item_type),  # EnumField in generate_composite
        "account": m.account,  # PrimitiveField in generate_composite
        "blockheight": m.blockheight,  # PrimitiveField in generate_composite
        "credit_msat": amount2msat(m.credit_msat),  # PrimitiveField in generate_composite
        "currency": m.currency,  # PrimitiveField in generate_composite
        "debit_msat": amount2msat(m.debit_msat),  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "fees_msat": amount2msat(m.fees_msat),  # PrimitiveField in generate_composite
        "is_rebalance": m.is_rebalance,  # PrimitiveField in generate_composite
        "origin": m.origin,  # PrimitiveField in generate_composite
        "outpoint": m.outpoint,  # PrimitiveField in generate_composite
        "part_id": m.part_id,  # PrimitiveField in generate_composite
        "payment_id": hexlify(m.payment_id),  # PrimitiveField in generate_composite
        "tag": m.tag,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
        "txid": hexlify(m.txid),  # PrimitiveField in generate_composite
    })


def bkpr_editdescriptionbyoutpoint2py(m):
    return remove_default({
        "updated": [bkpr_editdescriptionbyoutpoint_updated2py(i) for i in m.updated],  # ArrayField[composite] in generate_composite
    })


def bkpr_report2py(m):
    return remove_default({
        "report": [m.report for i in m.report], # ArrayField[primitive] in generate_composite
    })


def blacklistrune_blacklist2py(m):
    return remove_default({
        "end": m.end,  # PrimitiveField in generate_composite
        "start": m.start,  # PrimitiveField in generate_composite
    })


def blacklistrune2py(m):
    return remove_default({
        "blacklist": [blacklistrune_blacklist2py(i) for i in m.blacklist],  # ArrayField[composite] in generate_composite
    })


def checkrune2py(m):
    return remove_default({
        "valid": m.valid,  # PrimitiveField in generate_composite
    })


def createrune2py(m):
    return remove_default({
        "rune": m.rune,  # PrimitiveField in generate_composite
        "unique_id": m.unique_id,  # PrimitiveField in generate_composite
        "warning_unrestricted_rune": m.warning_unrestricted_rune,  # PrimitiveField in generate_composite
    })


def showrunes_runes_restrictions_alternatives2py(m):
    return remove_default({
        "condition": m.condition,  # PrimitiveField in generate_composite
        "english": m.english,  # PrimitiveField in generate_composite
        "fieldname": m.fieldname,  # PrimitiveField in generate_composite
        "value": m.value,  # PrimitiveField in generate_composite
    })


def showrunes_runes_restrictions2py(m):
    return remove_default({
        "alternatives": [showrunes_runes_restrictions_alternatives2py(i) for i in m.alternatives],  # ArrayField[composite] in generate_composite
        "english": m.english,  # PrimitiveField in generate_composite
    })


def showrunes_runes2py(m):
    return remove_default({
        "restrictions": [showrunes_runes_restrictions2py(i) for i in m.restrictions],  # ArrayField[composite] in generate_composite
        "blacklisted": m.blacklisted,  # PrimitiveField in generate_composite
        "last_used": m.last_used,  # PrimitiveField in generate_composite
        "our_rune": m.our_rune,  # PrimitiveField in generate_composite
        "restrictions_as_english": m.restrictions_as_english,  # PrimitiveField in generate_composite
        "rune": m.rune,  # PrimitiveField in generate_composite
        "stored": m.stored,  # PrimitiveField in generate_composite
        "unique_id": m.unique_id,  # PrimitiveField in generate_composite
    })


def showrunes2py(m):
    return remove_default({
        "runes": [showrunes_runes2py(i) for i in m.runes],  # ArrayField[composite] in generate_composite
    })


def askrene_unreserve2py(m):
    return remove_default({
    })


def askrene_listlayers_layers_biases2py(m):
    return remove_default({
        "bias": m.bias,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "short_channel_id_dir": m.short_channel_id_dir,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
    })


def askrene_listlayers_layers_channel_updates2py(m):
    return remove_default({
        "cltv_expiry_delta": m.cltv_expiry_delta,  # PrimitiveField in generate_composite
        "enabled": m.enabled,  # PrimitiveField in generate_composite
        "fee_base_msat": amount2msat(m.fee_base_msat),  # PrimitiveField in generate_composite
        "fee_proportional_millionths": m.fee_proportional_millionths,  # PrimitiveField in generate_composite
        "htlc_maximum_msat": amount2msat(m.htlc_maximum_msat),  # PrimitiveField in generate_composite
        "htlc_minimum_msat": amount2msat(m.htlc_minimum_msat),  # PrimitiveField in generate_composite
        "short_channel_id_dir": m.short_channel_id_dir,  # PrimitiveField in generate_composite
    })


def askrene_listlayers_layers_constraints2py(m):
    return remove_default({
        "maximum_msat": amount2msat(m.maximum_msat),  # PrimitiveField in generate_composite
        "minimum_msat": amount2msat(m.minimum_msat),  # PrimitiveField in generate_composite
        "short_channel_id_dir": m.short_channel_id_dir,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
    })


def askrene_listlayers_layers_created_channels2py(m):
    return remove_default({
        "capacity_msat": amount2msat(m.capacity_msat),  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "short_channel_id": m.short_channel_id,  # PrimitiveField in generate_composite
        "source": hexlify(m.source),  # PrimitiveField in generate_composite
    })


def askrene_listlayers_layers_node_biases2py(m):
    return remove_default({
        "description": m.description,  # PrimitiveField in generate_composite
        "in_bias": m.in_bias,  # PrimitiveField in generate_composite
        "node": hexlify(m.node),  # PrimitiveField in generate_composite
        "out_bias": m.out_bias,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
    })


def askrene_listlayers_layers2py(m):
    return remove_default({
        "biases": [askrene_listlayers_layers_biases2py(i) for i in m.biases],  # ArrayField[composite] in generate_composite
        "channel_updates": [askrene_listlayers_layers_channel_updates2py(i) for i in m.channel_updates],  # ArrayField[composite] in generate_composite
        "constraints": [askrene_listlayers_layers_constraints2py(i) for i in m.constraints],  # ArrayField[composite] in generate_composite
        "created_channels": [askrene_listlayers_layers_created_channels2py(i) for i in m.created_channels],  # ArrayField[composite] in generate_composite
        "disabled_channels": [m.disabled_channels for i in m.disabled_channels], # ArrayField[primitive] in generate_composite
        "disabled_nodes": [hexlify(m.disabled_nodes) for i in hexlify(m.disabled_nodes)], # ArrayField[primitive] in generate_composite
        "node_biases": [askrene_listlayers_layers_node_biases2py(i) for i in m.node_biases],  # ArrayField[composite] in generate_composite
        "layer": m.layer,  # PrimitiveField in generate_composite
        "persistent": m.persistent,  # PrimitiveField in generate_composite
    })


def askrene_listlayers2py(m):
    return remove_default({
        "layers": [askrene_listlayers_layers2py(i) for i in m.layers],  # ArrayField[composite] in generate_composite
    })


def askrene_create_layer_layers_biases2py(m):
    return remove_default({
        "bias": m.bias,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "short_channel_id_dir": m.short_channel_id_dir,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
    })


def askrene_create_layer_layers_channel_updates2py(m):
    return remove_default({
        "delay": m.delay,  # PrimitiveField in generate_composite
        "fee_base_msat": amount2msat(m.fee_base_msat),  # PrimitiveField in generate_composite
        "fee_proportional_millionths": m.fee_proportional_millionths,  # PrimitiveField in generate_composite
        "htlc_maximum_msat": amount2msat(m.htlc_maximum_msat),  # PrimitiveField in generate_composite
        "htlc_minimum_msat": amount2msat(m.htlc_minimum_msat),  # PrimitiveField in generate_composite
    })


def askrene_create_layer_layers_constraints2py(m):
    return remove_default({
        "direction": m.direction,  # PrimitiveField in generate_composite
        "maximum_msat": amount2msat(m.maximum_msat),  # PrimitiveField in generate_composite
        "minimum_msat": amount2msat(m.minimum_msat),  # PrimitiveField in generate_composite
        "short_channel_id": m.short_channel_id,  # PrimitiveField in generate_composite
    })


def askrene_create_layer_layers_created_channels2py(m):
    return remove_default({
        "capacity_msat": amount2msat(m.capacity_msat),  # PrimitiveField in generate_composite
        "destination": hexlify(m.destination),  # PrimitiveField in generate_composite
        "short_channel_id": m.short_channel_id,  # PrimitiveField in generate_composite
        "source": hexlify(m.source),  # PrimitiveField in generate_composite
    })


def askrene_create_layer_layers_node_biases2py(m):
    return remove_default({
        "description": m.description,  # PrimitiveField in generate_composite
        "in_bias": m.in_bias,  # PrimitiveField in generate_composite
        "node": hexlify(m.node),  # PrimitiveField in generate_composite
        "out_bias": m.out_bias,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
    })


def askrene_create_layer_layers2py(m):
    return remove_default({
        "biases": [askrene_create_layer_layers_biases2py(i) for i in m.biases],  # ArrayField[composite] in generate_composite
        "channel_updates": [askrene_create_layer_layers_channel_updates2py(i) for i in m.channel_updates],  # ArrayField[composite] in generate_composite
        "constraints": [askrene_create_layer_layers_constraints2py(i) for i in m.constraints],  # ArrayField[composite] in generate_composite
        "created_channels": [askrene_create_layer_layers_created_channels2py(i) for i in m.created_channels],  # ArrayField[composite] in generate_composite
        "disabled_channels": [m.disabled_channels for i in m.disabled_channels], # ArrayField[primitive] in generate_composite
        "disabled_nodes": [hexlify(m.disabled_nodes) for i in hexlify(m.disabled_nodes)], # ArrayField[primitive] in generate_composite
        "node_biases": [askrene_create_layer_layers_node_biases2py(i) for i in m.node_biases],  # ArrayField[composite] in generate_composite
        "layer": m.layer,  # PrimitiveField in generate_composite
        "persistent": m.persistent,  # PrimitiveField in generate_composite
    })


def askrene_create_layer2py(m):
    return remove_default({
        "layers": [askrene_create_layer_layers2py(i) for i in m.layers],  # ArrayField[composite] in generate_composite
    })


def askrene_remove_layer2py(m):
    return remove_default({
    })


def askrene_remove_channel_update2py(m):
    return remove_default({
    })


def askrene_reserve2py(m):
    return remove_default({
    })


def askrene_age2py(m):
    return remove_default({
        "layer": m.layer,  # PrimitiveField in generate_composite
        "num_removed": m.num_removed,  # PrimitiveField in generate_composite
    })


def getroutes_routes_path2py(m):
    return remove_default({
        "amount_in_msat": amount2msat(m.amount_in_msat),  # PrimitiveField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_out_msat": amount2msat(m.amount_out_msat),  # PrimitiveField in generate_composite
        "cltv_in": m.cltv_in,  # PrimitiveField in generate_composite
        "cltv_out": m.cltv_out,  # PrimitiveField in generate_composite
        "delay": m.delay,  # PrimitiveField in generate_composite
        "next_node_id": hexlify(m.next_node_id),  # PrimitiveField in generate_composite
        "node_id_in": hexlify(m.node_id_in),  # PrimitiveField in generate_composite
        "node_id_out": hexlify(m.node_id_out),  # PrimitiveField in generate_composite
        "short_channel_id_dir": m.short_channel_id_dir,  # PrimitiveField in generate_composite
    })


def getroutes_routes2py(m):
    return remove_default({
        "path": [getroutes_routes_path2py(i) for i in m.path],  # ArrayField[composite] in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "final_cltv": m.final_cltv,  # PrimitiveField in generate_composite
        "probability_ppm": m.probability_ppm,  # PrimitiveField in generate_composite
    })


def getroutes2py(m):
    return remove_default({
        "routes": [getroutes_routes2py(i) for i in m.routes],  # ArrayField[composite] in generate_composite
        "probability_ppm": m.probability_ppm,  # PrimitiveField in generate_composite
    })


def askrene_disable_node2py(m):
    return remove_default({
    })


def askrene_inform_channel_constraints2py(m):
    return remove_default({
        "layer": m.layer,  # PrimitiveField in generate_composite
        "maximum_msat": amount2msat(m.maximum_msat),  # PrimitiveField in generate_composite
        "minimum_msat": amount2msat(m.minimum_msat),  # PrimitiveField in generate_composite
        "short_channel_id_dir": m.short_channel_id_dir,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
    })


def askrene_inform_channel2py(m):
    return remove_default({
        "constraints": [askrene_inform_channel_constraints2py(i) for i in m.constraints],  # ArrayField[composite] in generate_composite
    })


def askrene_create_channel2py(m):
    return remove_default({
    })


def askrene_update_channel2py(m):
    return remove_default({
    })


def askrene_bias_channel_biases2py(m):
    return remove_default({
        "bias": m.bias,  # PrimitiveField in generate_composite
        "description": m.description,  # PrimitiveField in generate_composite
        "layer": m.layer,  # PrimitiveField in generate_composite
        "short_channel_id_dir": m.short_channel_id_dir,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
    })


def askrene_bias_channel2py(m):
    return remove_default({
        "biases": [askrene_bias_channel_biases2py(i) for i in m.biases],  # ArrayField[composite] in generate_composite
    })


def askrene_bias_node_node_biases2py(m):
    return remove_default({
        "description": m.description,  # PrimitiveField in generate_composite
        "in_bias": m.in_bias,  # PrimitiveField in generate_composite
        "layer": m.layer,  # PrimitiveField in generate_composite
        "node": hexlify(m.node),  # PrimitiveField in generate_composite
        "out_bias": m.out_bias,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
    })


def askrene_bias_node2py(m):
    return remove_default({
        "node_biases": [askrene_bias_node_node_biases2py(i) for i in m.node_biases],  # ArrayField[composite] in generate_composite
    })


def askrene_listreservations_reservations2py(m):
    return remove_default({
        "age_in_seconds": m.age_in_seconds,  # PrimitiveField in generate_composite
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "command_id": m.command_id,  # PrimitiveField in generate_composite
        "short_channel_id_dir": m.short_channel_id_dir,  # PrimitiveField in generate_composite
    })


def askrene_listreservations2py(m):
    return remove_default({
        "reservations": [askrene_listreservations_reservations2py(i) for i in m.reservations],  # ArrayField[composite] in generate_composite
    })


def injectpaymentonion2py(m):
    return remove_default({
        "completed_at": m.completed_at,  # PrimitiveField in generate_composite
        "created_at": m.created_at,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
    })


def injectonionmessage2py(m):
    return remove_default({
    })


def xpay2py(m):
    return remove_default({
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "failed_parts": m.failed_parts,  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "successful_parts": m.successful_parts,  # PrimitiveField in generate_composite
    })


def signmessagewithkey2py(m):
    return remove_default({
        "address": m.address,  # PrimitiveField in generate_composite
        "base64": m.base64,  # PrimitiveField in generate_composite
        "pubkey": hexlify(m.pubkey),  # PrimitiveField in generate_composite
        "signature": hexlify(m.signature),  # PrimitiveField in generate_composite
    })


def listchannelmoves_channelmoves2py(m):
    return remove_default({
        "primary_tag": str(m.primary_tag),  # EnumField in generate_composite
        "account_id": m.account_id,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "credit_msat": amount2msat(m.credit_msat),  # PrimitiveField in generate_composite
        "debit_msat": amount2msat(m.debit_msat),  # PrimitiveField in generate_composite
        "fees_msat": amount2msat(m.fees_msat),  # PrimitiveField in generate_composite
        "group_id": m.group_id,  # PrimitiveField in generate_composite
        "part_id": m.part_id,  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
    })


def listchannelmoves2py(m):
    return remove_default({
        "channelmoves": [listchannelmoves_channelmoves2py(i) for i in m.channelmoves],  # ArrayField[composite] in generate_composite
    })


def listchainmoves_chainmoves2py(m):
    return remove_default({
        "extra_tags": [m.extra_tags for i in m.extra_tags], # ArrayField[primitive] in generate_composite
        "primary_tag": str(m.primary_tag),  # EnumField in generate_composite
        "account_id": m.account_id,  # PrimitiveField in generate_composite
        "blockheight": m.blockheight,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "credit_msat": amount2msat(m.credit_msat),  # PrimitiveField in generate_composite
        "debit_msat": amount2msat(m.debit_msat),  # PrimitiveField in generate_composite
        "originating_account": m.originating_account,  # PrimitiveField in generate_composite
        "output_count": m.output_count,  # PrimitiveField in generate_composite
        "output_msat": amount2msat(m.output_msat),  # PrimitiveField in generate_composite
        "payment_hash": hexlify(m.payment_hash),  # PrimitiveField in generate_composite
        "peer_id": hexlify(m.peer_id),  # PrimitiveField in generate_composite
        "spending_txid": hexlify(m.spending_txid),  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
        "utxo": m.utxo,  # PrimitiveField in generate_composite
    })


def listchainmoves2py(m):
    return remove_default({
        "chainmoves": [listchainmoves_chainmoves2py(i) for i in m.chainmoves],  # ArrayField[composite] in generate_composite
    })


def listnetworkevents_networkevents2py(m):
    return remove_default({
        "connect_attempted": m.connect_attempted,  # PrimitiveField in generate_composite
        "created_index": m.created_index,  # PrimitiveField in generate_composite
        "duration_nsec": m.duration_nsec,  # PrimitiveField in generate_composite
        "peer_id": hexlify(m.peer_id),  # PrimitiveField in generate_composite
        "reason": m.reason,  # PrimitiveField in generate_composite
        "timestamp": m.timestamp,  # PrimitiveField in generate_composite
        "item_type": m.type,  # PrimitiveField in generate_composite
    })


def listnetworkevents2py(m):
    return remove_default({
        "networkevents": [listnetworkevents_networkevents2py(i) for i in m.networkevents],  # ArrayField[composite] in generate_composite
    })


def delnetworkevent2py(m):
    return remove_default({
    })


def clnrest_register_path2py(m):
    return remove_default({
    })


def listcurrencyrates_currencyrates2py(m):
    return remove_default({
        "amount": m.amount,  # PrimitiveField in generate_composite
        "source": m.source,  # PrimitiveField in generate_composite
    })


def listcurrencyrates2py(m):
    return remove_default({
        "currencyrates": [listcurrencyrates_currencyrates2py(i) for i in m.currencyrates],  # ArrayField[composite] in generate_composite
    })


def currencyconvert2py(m):
    return remove_default({
        "msat": amount2msat(m.msat),  # PrimitiveField in generate_composite
    })


def currencyrate2py(m):
    return remove_default({
        "rate": m.rate,  # PrimitiveField in generate_composite
    })


def sendamount2py(m):
    return remove_default({
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "failed_parts": m.failed_parts,  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "successful_parts": m.successful_parts,  # PrimitiveField in generate_composite
    })


def createproof_proofs2py(m):
    return remove_default({
        "invoice_fields_included": [m.invoice_fields_included for i in m.invoice_fields_included], # ArrayField[primitive] in generate_composite
        "invreq_fields_included": [m.invreq_fields_included for i in m.invreq_fields_included], # ArrayField[primitive] in generate_composite
        "offer_fields_included": [m.offer_fields_included for i in m.offer_fields_included], # ArrayField[primitive] in generate_composite
        "bolt12": m.bolt12,  # PrimitiveField in generate_composite
    })


def createproof2py(m):
    return remove_default({
        "proofs": [createproof_proofs2py(i) for i in m.proofs],  # ArrayField[composite] in generate_composite
    })


def xkeysend2py(m):
    return remove_default({
        "amount_msat": amount2msat(m.amount_msat),  # PrimitiveField in generate_composite
        "amount_sent_msat": amount2msat(m.amount_sent_msat),  # PrimitiveField in generate_composite
        "failed_parts": m.failed_parts,  # PrimitiveField in generate_composite
        "payment_preimage": hexlify(m.payment_preimage),  # PrimitiveField in generate_composite
        "successful_parts": m.successful_parts,  # PrimitiveField in generate_composite
    })


def graceful2py(m):
    return remove_default({
        "pending_htlc_expiries": [m.pending_htlc_expiries for i in m.pending_htlc_expiries], # ArrayField[primitive] in generate_composite
        "pending_peers": [hexlify(m.pending_peers) for i in hexlify(m.pending_peers)], # ArrayField[primitive] in generate_composite
    })


def decodekeysend_routes2py(m): # manual override
    return remove_default({
        "expirydelta": m.expirydelta,
        "feebase": amount2msat(m.feebase),
        "feeprop": m.feeprop,
        "id": hexlify(m.id),
        "scid": m.scid,
    })


def decodepay_routes2py(m): # manual override
    return remove_default({
        "cltv_expiry_delta": m.cltv_expiry_delta,
        "fee_base_msat": amount2msat(m.fee_base_msat),
        "fee_proportional_millionths": m.fee_proportional_millionths,
        "pubkey": hexlify(m.pubkey),
        "short_channel_id": m.short_channel_id,
    })
