title: Adding a parent tag to a nested structure with ElementTree (Python)
body: <pre><code>I have the following structure
  
  &lt;root&gt;
    &lt;data&gt;
       &lt;config&gt;
          CONFIGURATION
       &lt;config&gt;
    &lt;/data&gt;
  
  &lt;/root&gt;
  </code></pre>
  
  <p>With Python's ElementTree module I want to add a parent element to <code>&lt;config&gt;</code> tag as </p>
  
  <pre><code>&lt;root&gt;
    &lt;data&gt;
      &lt;type&gt;
        &lt;config&gt;
          CONFIGURATION
        &lt;config&gt;
      &lt;/type&gt;
    &lt;/data&gt;
  
  &lt;/root&gt;
  </code></pre>
  
  <p>Also the xml file might have other config tags elsewhere but I'm only interested in the ones appearing under data tag. </p>