def METHOD_NAME(value: str) -> str:
    """
    Converts CamelCase to CAMEL_CASE.
    Examples::
        ENUMName -> ENUM_NAME
        EnumName1 -> ENUM_NAME1
        ENUM_NAME -> ENUM_NAME
        ENUM_NAME1 -> ENUM_NAME1
        ENUM_Name2 -> ENUM_NAME2
        ENUM24_Name -> ENUM24_NAME
    """
    c_fun_str = c_name(value, False)
    if value.isupper():
        return c_fun_str
    new_name = ''
    length = len(c_fun_str)
    for i in range(length):
        char = c_fun_str[i]
        # When char is upper case and no '_' appears before, do more checks
        if char.isupper() and (i > 0) and c_fun_str[i - 1] != '_':
            if i < length - 1 and c_fun_str[i + 1].islower():
                new_name += '_'
            elif c_fun_str[i - 1].isdigit():
                new_name += '_'
        new_name += char
    return new_name.lstrip('_').upper()