def METHOD_NAME(file: str, toc: list) -> None:
    for item in toc:
        if isinstance(item, str):
            IndexPages._write_str_index(file, item)
        elif isinstance(item, dict):
            IndexPages._write_dict_index(file, item)
        else:
            raise NotImplementedError(f"{item}")