Having no response to my question I have given up. I only use a subset of toml and so I wrote the functionality my self and dumped tomli and tomli_w from the project.
It now works