title: How to check whether two elements in an xml has same value for its attribute
body: <p>Consider the following example,</p>
  
  <p>I need to check whether any two country has same neighbor , by comparing <code>name</code> attribute of all the neighbour tags.
  I am using <code>.attrib</code> and then comparing the dictionary which is the output of .attrib based on key as of now. Is there a simpler way to check exactly the attribute ?</p>
  
  <pre><code> &lt;data&gt;
          &lt;country name="Liechtenstein"&gt;
              &lt;rank&gt;1&lt;/rank&gt;
              &lt;year&gt;2008&lt;/year&gt;
              &lt;gdppc&gt;141100&lt;/gdppc&gt;
              &lt;neighbor name="Austria" direction="E"/&gt;
              &lt;neighbor name="Switzerland" direction="W"/&gt;
          &lt;/country&gt;
          &lt;country name="Singapore"&gt;
              &lt;rank&gt;4&lt;/rank&gt;
              &lt;year&gt;2011&lt;/year&gt;
              &lt;gdppc&gt;59900&lt;/gdppc&gt;
              &lt;neighbor name="Malaysia" direction="N"/&gt;
          &lt;/country&gt;
          &lt;country name="Panama"&gt;
              &lt;rank&gt;68&lt;/rank&gt;
              &lt;year&gt;2011&lt;/year&gt;
              &lt;gdppc&gt;13600&lt;/gdppc&gt;
              &lt;neighbor name="Costa Rica" direction="W"/&gt;
              &lt;neighbor name="Colombia" direction="E"/&gt;
          &lt;/country&gt;
  &lt;/data&gt;
  </code></pre>
  
  <p>I am using lxml in python.</p>