def create_inputs_dict(node_tree, node, memo):
    """
    Produce some `code` that instantiates all node INPUTS to `node`,
    as well as a python dict `inputs_dict` containing all the variable
    names that should be used to refer to each of the inputs we instantiated
    """

    inputs_dict = {}
    code = ""

    def update_inputs(i, k, v):
        is_input_name_unique = [socket.name for socket in node.inputs].count(k) == 1
        k = repr(k) if is_input_name_unique else i
        if k not in inputs_dict:
            inputs_dict[k] = v
        else:
            if not isinstance(inputs_dict[k], list):
                inputs_dict[k] = [inputs_dict[k]]
            inputs_dict[k].append(v)

    new_transpile_targets = {}
    for i, (input_name, input_socket) in enumerate(node.inputs.items()):
        links = get_connected_link(node_tree, input_socket)

        if links is None:
            if hasattr(input_socket, "default_value"):
                if not has_default_value_changed(node_tree, node, input_socket):
                    continue
                input_expression, targets = represent_default_value(
                    input_socket.default_value, simple=False
                )
                new_transpile_targets.update(targets)
                update_inputs(i, input_name, input_expression)
            continue

        for link in links:
            if not link.from_socket.enabled:
                logger.warning(
                    f"Transpiler encountered link from disabled socket {link.from_socket}, ignoring it"
                )
                continue
            if not link.to_socket.enabled:
                logger.warning(
                    f"Transpiler encountered link to disabled socket {link.to_socket}, ignoring it"
                )
                continue

            input_varname, input_code, targets = create_node(
                node_tree, link.from_node, memo
            )
            code += input_code
            new_transpile_targets.update(targets)

            if len(link.from_node.outputs) == 1:
                input_expression = input_varname
            else:
                socket_name = link.from_socket.name
                input_expression = f'{input_varname}.outputs["{socket_name}"]'

                # Catch shared socket output names
                if (
                    link.from_node.outputs[socket_name].identifier
                    != link.from_socket.identifier
                ):
                    from_idx = [
                        i
                        for i, o in enumerate(link.from_node.outputs)
                        if o.identifier == link.from_socket.identifier
                    ][0]
                    input_expression = f"{input_varname}.outputs[{from_idx}]"

            update_inputs(i, input_name, input_expression)

    return inputs_dict, code, new_transpile_targets

    Produce some `code` that instantiates all node INPUTS to `node`,
    as well as a python dict `inputs_dict` containing all the variable
    names that should be used to refer to each of the inputs we instantiated
    
infinigen/core/nodes/node_transpiler/transpiler.py