def write_function_body(target):
    """
    Construct a python function body which will produce the node_tree of the `target`
    """

    output_node_id = OUTPUT_NODE_IDS[type(target)]
    node_tree = get_node_tree(target)

    try:
        output_node = next(n for n in node_tree.nodes if n.bl_idname == output_node_id)
    except StopIteration:
        logging.info([n.bl_idname for n in node_tree.nodes])
        raise ValueError(
            f"Couldnt find expected {output_node_id=} for node tree type {node_tree.bl_idname=}"
        )

    memo = {}
    final_varname, code, new_transpile_targets = create_node(
        node_tree, output_node, memo
    )
    return code, new_transpile_targets

    Construct a python function body which will produce the node_tree of the `target`
    
infinigen/core/nodes/node_transpiler/transpiler.py