def infer_output_socket(item):
    """
    Figure out if `item` somehow represents a node with an output we can use.
    If so, return that output socket
    """

    if isinstance(item, bpy.types.NodeSocket):
        res = item
    elif isnode(item):
        # take the first active socket
        try:
            res = next(o for o in item.outputs if o.enabled)
        except StopIteration:
            raise ValueError(
                f"Attempted to get output socket for {item} but none are enabled!"
            )
    elif isinstance(item, tuple) and isnode(item[0]):
        node, socket_name = item
        if isinstance(socket_name, int):
            return node.outputs[socket_name]
        try:
            res = next(o for o in node.outputs if o.enabled and o.name == socket_name)
        except StopIteration:
            raise ValueError(
                f"Couldnt find an enabled socket on {node} corresponding to requested tuple {item}"
            )
    else:
        return None

    if not res.enabled:
        raise ValueError(
            f"Attempted to use output socket {res} of node {res.node} which is not enabled. "
            "Please check your attrs are correct, or be more specific about the socket to use"
        )

    return res

    Figure out if `item` somehow represents a node with an output we can use.
    If so, return that output socket
    
infinigen/core/nodes/utils.py