tomlkit

Style preserving TOML library

Here are some articles that you may find helpful