def get_varname(node, taken):
    """
    Choose a sensible python variable name to represent `node`,
    notably one which isnt in the list of already used variable names `taken`
    """

    if node.label:
        name = node.label.split("~")[
            0
        ].strip()  # remove any allowed postprocessor flags
        name = snake_case(name)
    elif hasattr(node, "operation"):
        # name the math nodes after their operations, for readability
        name = snake_case(node.operation.lower())
    elif node.bl_idname == "GeometryNodeGroup":
        name = snake_case(node.node_tree.name.lower())
    else:
        # for all other nodes, use the node.name, which should be unique to this node
        name, *rest = node.name.split(".")
        name = name.lower().replace(" ", "_")

        if len(rest) > 0:
            assert len(rest) == 1
            name += "_" + str(int(rest[0]))

    name = re.sub("[^0-9a-zA-Z_]+", "_", name)
    name = re.sub("_+", "_", name)
    name = name.strip("_")

    if keyword.iskeyword(name):
        name = "op_" + name

    if name in taken:
        i = 1
        while f"{name}_{i}" in taken:
            i += 1
        name = f"{name}_{i}"

    return name

    Choose a sensible python variable name to represent `node`,
    notably one which isnt in the list of already used variable names `taken`
    
infinigen/core/nodes/node_transpiler/transpiler.py