@@ -0,0 +1,697 @@
+import re%0Aimport os%0A%0Are_imp = re.compile('%5E(#)*?(%5B%5E#=%5D*?)%5C =%5C (.*?)$', re.M)%0A%0Aclass Environment(dict):%0A    def get_flat(self, k):%0A        s = self%5Bk%5D%0A        if isinstance(s, str):%0A            return s%0A        else:%0A            return %22 %22.join(s)%0A%0A    def store(self, filename):%0A        tmp = filename + %22.tmp%22%0A        fid = open(tmp, %22w%22)%0A        for k in sorted(self.keys()):%0A            fid.write(%22%25s = %25r%22 %25 (k, self%5Bk%5D))%0A%0A        try:%0A            os.unlink(filename)%0A        except OSError:%0A            pass%0A%0A        os.rename(tmp, filename)%0A%0A    def load(self, filename):%0A        f = open(filename)%0A        for m in re_imp.finditer(f.read()):%0A            self%5Bm.group(2)%5D = eval(m.group(3))%0A

add an environment class.