def represent_label_value_expression(expression):
    """
    When the user puts "var ~ N(0, 1)" or something of the like as the label of their node,
    this function parses everything after the ~ into a python expression

    Must be of form {operation}({argument})

    Valid operations:
    - U, uniform
    - N, normal
    - color, color_category

    Valid arguments: str, float, list of float

    """

    def parse_arg(arg):
        arg = arg.strip(" ,")

        if arg.strip("'\"").isalpha():
            return arg.strip("'\"")

        try:
            return float(arg)
        except ValueError:
            pass

        if arg.startswith("["):
            vals = arg.strip("[]").split(",")
            return [parse_arg(v) for v in vals]
        else:
            raise ValueError(
                f"represent_label_value_expression had invalid argument {arg}"
            )

    matched_chars = {"'": "'", '"': '"', "[": "]"}

    def parse_args(arg_str):
        args = []

        remaining = arg_str
        while len(remaining) != 0:
            remaining = remaining.strip(", ")

            search_for = matched_chars.get(remaining[0], ",")
            next_idx = (
                remaining[1:].index(search_for) + 1
                if search_for in remaining
                else len(remaining)
            )
            arg = remaining[: next_idx + 1]
            remaining = remaining[next_idx + 1 :]

            try:
                args.append(parse_arg(arg))
            except ValueError:
                raise ValueError(
                    f"Could not parse node label expression {repr(arg_str)}, item {repr(arg)} was not a valid argument"
                )

        return args

    op, args = expression.split("(")
    op = op.strip()
    args = parse_args(args.strip(")"))

    if op in ["N", "normal", "U", "uniform", "R", "randint"]:
        if not len(args) == 2:
            raise ValueError(
                f"In {expression=}, expected 2 arguments, got {len(args)} instead"
            )
        funcname = {
            "N": "normal",
            "normal": "normal",
            "U": "uniform",
            "uniform": "uniform",
            "R": "randint",
            "randint": "randint",
        }[op]
        args = ", ".join(repr(a) for a in args)
        return f"{funcname}({args})"

    elif op in ["color", "color_category"]:
        if not len(args) == 1:
            raise ValueError(
                f"In {expression=}, expected 1 argument, got {len(args)} instead"
            )
        return f"color_category({repr(args[0])})"
    else:
        raise ValueError(
            f"Failed to represent_label_value_expression({expression=}), unrecognized {op=}"
        )

    When the user puts "var ~ N(0, 1)" or something of the like as the label of their node,
    this function parses everything after the ~ into a python expression

    Must be of form {operation}({argument})

    Valid operations:
    - U, uniform
    - N, normal
    - color, color_category

    Valid arguments: str, float, list of float

    
infinigen/core/nodes/node_transpiler/transpiler.py