def METHOD_NAME(cargo_lock_file, spec_file, cleaned):
    # Generate 'Provides' out of cargo_lock_file
    with open(cargo_lock_file, "r") as file:
        contents = file.read()
    data = toml.loads(contents)
    provides_lines = []
    for package in data["package"]:
        provides_lines.append(f"Provides:  bundled(crate({package['name']})) = {package['version'].replace('-', '_')}\n")
    # Find a line index where 'Provides' ends
    with open(spec_file, "r") as file:
        spec_file_lines = file.readlines()
    last_provides = -1
    for i in range(0, len(spec_file_lines)):
        if spec_file_lines[i].startswith("%description"):
            break
        if spec_file_lines[i].startswith("Provides:"):
            last_provides = i
    # Insert the generated 'Provides' to the specfile
    log.info(f"Add the fresh '{SPECFILE_COMMENT_LINE}' content to {spec_file}")
    i = last_provides + 2
    spec_file_lines.insert(i, START_LINE)
    for line in sorted(provides_lines):
        i = i + 1
        log.debug(f"Adding '{line[:-1]}' as a line {i} to buffer")
        spec_file_lines.insert(i, line)
    i = i + 1
    spec_file_lines.insert(i, END_LINE)
    # Insert an empty line if we haven't cleaned the old content
    # (as the old content already has an extra empty line that wasn't removed)
    if not cleaned:
        i = i + 1
        spec_file_lines.insert(i, "\n")
    log.debug(f"Commit the buffer to {spec_file}")
    with open(spec_file, "w") as file:
        file.writelines(spec_file_lines)