def rename_immediate():
    highlighted = idaapi.get_highlighted_identifier()
    try:
        desired = int(highlighted, 0)
    except (ValueError, __HOLE__):
        desired = None
    value = idc.AskLong(get_common_value(desired), "Const Value")
    if value is None:
        return

    name = idc.AskStr("", "Constant Name")
    if name is None:
        return

    try:
        enum = sark.Enum('GlobalConstants')
    except sark.exceptions.EnumNotFound:
        enum = sark.add_enum('GlobalConstants')

    enum.members.add(name, value)
    apply_enum_by_name(enum, name)
dataset/ETHPy150Open tmr232/Sark/plugins/autoenum.py/rename_immediate