How to make a copy of xml tree in python using ElementTree?
<p>I'm using  xml.etree.ElementTree to parse xml file. I'm parsing xml file in the following way:</p>

<pre><code>import xml.etree.ElementTree as ET
tree = ET.parse(options.xmlfile)
root = tree.getroot()
</code></pre>

<p>This is my xml file:</p>

<pre><code>&lt;rootElement&gt;
    &lt;member&gt;
        &lt;member_id&gt;439854395435&lt;/member_id&gt;
    &lt;/member&gt;
&lt;/rootElement&gt;
</code></pre>

<p>Then I'm saving it:</p>

<pre><code>tree.write(options.outcsvfile)
</code></pre>

<p>How can I make a copy of my tree to produce something like this:</p>

<pre><code>&lt;rootElement&gt;
    &lt;member&gt;
        &lt;member_id&gt;439854395435&lt;/member_id&gt;
    &lt;/member&gt;
    &lt;member&gt;
        &lt;member_id&gt;439854395435&lt;/member_id&gt;
    &lt;/member&gt;
&lt;/rootElement&gt;
</code></pre>