[Bug #523301] ConfigParser.write() produces broken output for values that
   were originally rfc822-like line continuations.
   Modified version of a patch from Matthias Ralfs.
diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py
index 190b694..bdce25e 100644
--- a/Lib/ConfigParser.py
+++ b/Lib/ConfigParser.py
@@ -344,7 +344,7 @@
         if self.__defaults:
             fp.write("[DEFAULT]\n")
             for (key, value) in self.__defaults.items():
-                fp.write("%s = %s\n" % (key, value))
+                fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t')))
             fp.write("\n")
         for section in self.sections():
             fp.write("[" + section + "]\n")
@@ -352,7 +352,7 @@
             for (key, value) in sectdict.items():
                 if key == "__name__":
                     continue
-                fp.write("%s = %s\n" % (key, value))
+                fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t')))
             fp.write("\n")
 
     def remove_option(self, section, option):