def arg_name(arg_index=lambda ctx: ctx["operands"][0].value):
    """
    Returns a lambda that gets the name of the argument at the given index.
    The index defaults to the first operand's value.
    """
    return lambda ctx: (ctx["arg_names"][arg_index(ctx)]
                            if arg_index(ctx) < len(ctx["arg_names"])
                            else "var%s" % arg_index(ctx))