I think the simplest solution would be:
key1="value1" key2="value2" key3="value3"
in shell you just need the source of this env file and in Python, it is easy to parse.
Spaces are not allowed around =
For Python, see this post: Bash 'source' emulation in Python
Gilles quenot
source share