title: python + libxml2: Sorting XML node's elements according to attribute's value
body: <p>I have the following node in an XML-document:</p>
  
  <pre><code>&lt;state&gt;
      &lt;soso value="3"/&gt;
      &lt;good value="1"/&gt;
      &lt;bad value="2"/&gt;
      &lt;unknown value="0"/&gt;
  &lt;/state&gt;
  </code></pre>
  
  <p>I need to sort its elements according to the <code>value</code> attribute's value, so that the result is the following:</p>
  
  <pre><code>&lt;state&gt;
      &lt;unknown value="0"/&gt;
      &lt;good value="1"/&gt;
      &lt;bad value="2"/&gt;
      &lt;soso value="3"/&gt;
  &lt;/state&gt;
  </code></pre>
  
  <p>How would one do it in python using libxml2?</p>