def check_model_list_for_task(task_guide: str, overwrite: bool = False):
    """
    For a given task guide, checks the model list in the generated tip for consistency with the state of the lib and
    updates it if needed.

    Args:
        task_guide (`str`):
            The name of the task guide to check.
        overwrite (`bool`, *optional*, defaults to `False`):
            Whether or not to overwrite the table when it's not up to date.
    """
    current_list, start_index, end_index, lines = _find_text_in_file(
        filename=os.path.join(PATH_TO_TASK_GUIDES, task_guide),
        start_prompt="<!--This tip is automatically generated by `make fix-copies`, do not fill manually!-->",
        end_prompt="<!--End of the generated tip-->",
    )

    new_list = get_model_list_for_task(task_guide)

    if current_list != new_list:
        if overwrite:
            with open(os.path.join(PATH_TO_TASK_GUIDES, task_guide), "w", encoding="utf-8", newline="\n") as f:
                f.writelines(lines[:start_index] + [new_list] + lines[end_index:])
        else:
            raise ValueError(
                f"The list of models that can be used in the {task_guide} guide needs an update. Run `make fix-copies`"
                " to fix this."
            )

    For a given task guide, checks the model list in the generated tip for consistency with the state of the lib and
    updates it if needed.

    Args:
        task_guide (`str`):
            The name of the task guide to check.
        overwrite (`bool`, *optional*, defaults to `False`):
            Whether or not to overwrite the table when it's not up to date.
    
dpkd/transformers/utils/check_task_guides.py