title: Write comment in config files with python
body: <p>I need to write some comment in a configuration file generated at <em>runtime</em> via <code>ConfigParser</code> library in Python.</p>
  
  <p>I want to write a full descriptive comment like:</p>
  
  <pre><code>########################
  # FOOBAR section 
  # do something 
  ########################
  [foobar]
  bar = 1
  foo = hallo
  </code></pre>
  
  <p>The code should look like:</p>
  
  <p>Where I insert comment and configurations options in the same moment.</p>
  
  <pre><code>import ConfigParser
  
  config = ConfigParser.ConfigParser()
  
  config.insert_comment("##########################") # This function is purely hypothetical 
  config.insert_comment("# FOOBAR section ")
  ....
  
  config.add_section('foobar')
  config.set('foobar', 'bar', '1')
  config.set('foobar', 'foo', 'hallo')
  </code></pre>