def METHOD_NAME(file: Union[str, os.PathLike]) -> None:
    """Annotate a pymodbus log file in-place with explanations."""
    with open(file, encoding="utf-8") as in_file, tempfile.NamedTemporaryFile(
        mode="w", encoding="utf-8", delete=False
    ) as out_file:
        for i, line in enumerate(in_file):
            if "Running transaction" in line and i > 0:
                out_file.write("\n")
            out_file.write(line)
            if "SEND:" in line:
                explained = explain_with_rapid_scada(
                    packet=line.split("SEND:")[1].strip(),
                )
                out_file.write(
                    f"Send explained: {explained}\n"
                    f"Send summary: {explained.summarize()}\n",
                )
            if "RECV:" in line:
                explained = explain_with_rapid_scada(
                    packet=line.split("RECV:")[1].strip(),
                    is_receive=True,
                )
                out_file.write(
                    f"Receive explained: {explained}\n"
                    f"Receive summary: {explained.summarize()}\n",
                )
    # NOTE: per NamedTemporaryFile docs, the name cannot be reused on Windows
    # while the file is still open. So we have to use delete=False followed by
    # manually removing the temp file
    shutil.copyfile(out_file.name, file)
    with contextlib.suppress(FileNotFoundError):
        os.remove(out_file.name)