Read and update git config with python?

I tried configparser, but it does not respect indentation for git config files (git config files have indentation inside sections as opposed to linux usual format without indentation). After I update