title: how to sort XML data in given order in Python
body: <p>Not sure if this is going to be a duplicate question..I have tried to find a related answer but not quite found it..here I go..</p>
  
  <p>Here is what I have in XML format data</p>
  
  <pre><code>&lt;item&gt;
  &lt;title&gt;level red&lt;/title&gt;
  &lt;link&gt;something&lt;/link&gt;
  &lt;item&gt;
  
  &lt;item&gt;
  &lt;title&gt;level green&lt;/title&gt;
  &lt;link&gt;something&lt;/link&gt;
  &lt;item&gt;
  
  &lt;item&gt;
  &lt;title&gt;level yellow&lt;/title&gt;
  &lt;link&gt;something&lt;/link&gt;
  &lt;item&gt;
  
  &lt;item&gt;
  &lt;title&gt;level red&lt;/title&gt;
  &lt;link&gt;something&lt;/link&gt;
  &lt;item&gt;
  
  &lt;item&gt;
  &lt;title&gt;level yellow&lt;/title&gt;
  &lt;link&gt;something&lt;/link&gt;
  &lt;item&gt;
  
  &lt;item&gt;
  &lt;title&gt;level red&lt;/title&gt;
  &lt;link&gt;something&lt;/link&gt;
  &lt;item&gt;
  
  &lt;item&gt;
  &lt;title&gt;level green&lt;/title&gt;
  &lt;link&gt;something&lt;/link&gt;
  &lt;item&gt;
  
  &lt;item&gt;
  &lt;title&gt;level black&lt;/title&gt;
  &lt;link&gt;something&lt;/link&gt;
  &lt;item&gt;
  </code></pre>
  
  <p>My aim is to sort this data in a where  level red first and level green and level yellow comes in the xml list and the rest of level stays whatever..</p>
  
  <p>My question is how do I approach this with Python?</p>
  
  <p>I know I might have to use</p>
  
  <pre><code>dom =  xml.dom.minidom.parseString(stripTags(data))
  items = dom.getElementsByTagName('item')
  
  item.getElementsByTagName("title")[0].childNodes
  item.getElementsByTagName("link")[0].childNodes
  </code></pre>
  
  <p>I have also seen code like this to sort in order</p>
  
  <pre><code>sorted_b = []
  for i in a:
      for j in b:
          if j.id == i:
              sorted_b.append(j)
              break
  </code></pre>
  
  <p>My problem is how do I put the code together and later how i sort the data in my given order of color priority?</p>
  
  <p>Any suggestion or direction is appreciated</p>