def METHOD_NAME(lines: list[str], lnum: int, lnumend: int, out: str) -> str:
    val = 0
    for i in range(lnum + 1, lnumend):
        line = lines[i]
        if line.strip().startswith('//'):
            continue
        # Strip off any trailing comment.
        if '//' in line:
            line = line.split('//')[0].strip()
        # Strip off any trailing comma.
        if line.endswith(','):
            line = line[:-1].strip()
        # If they're explicitly assigning a value, parse it.
        if '=' in line:
            splits = line.split()
            if (
                len(splits) != 3
                or splits[1] != '='
                or not splits[2].isnumeric()
            ):
                raise RuntimeError(f'Unable to parse enum value for: {line}')
            name = splits[0]
            val = int(splits[2])
        else:
            name = line
        # name = line.split(',')[0].split('//')[0].strip()
        if not name.startswith('k') or len(name) < 2:
            raise RuntimeError(f"Expected name to start with 'k'; got {name}")
        # We require kLast to be the final value
        # (C++ requires this for bounds checking)
        if i == lnumend - 1:
            if name != 'kLast':
                raise RuntimeError(
                    f'Expected last enum value of kLast; found {name}.'
                )
            continue
        name = camel_case_convert(name[1:])
        out += f'    {name} = {val}\n'
        val += 1
    return out