title: How to iterate through Elementtree using namespaces
body: <p>I have been trying to parse through an xml document using ElementTree in python to modify one of the elements, however I keep running into issues due to namespaces. </p>
  
  <p>I can get all the tags from my xml document with</p>
  
  <pre><code>data = open('query-user-by-name.xml').read()
  root = ET.fromstring(data)
  for item in root.iter():
      print(item.tag)
  </code></pre>
  
  <p>which gives me:</p>
  
  <pre><code>{http://prism.evolveum.com/xml/ns/public/query-3}query
  {http://prism.evolveum.com/xml/ns/public/query-3}filter
  {http://prism.evolveum.com/xml/ns/public/query-3}equal
  {http://prism.evolveum.com/xml/ns/public/query-3}matching
  {http://prism.evolveum.com/xml/ns/public/query-3}path
  {http://prism.evolveum.com/xml/ns/public/query-3}value
  </code></pre>
  
  <p>I have created a dictionary with a namespace:</p>
  
  <pre><code>namespaces = {'ns':'http://prism.evolveum.com/xml/ns/public/query-3'}
  </code></pre>
  
  <p>but when I try to find the element I am searching for with </p>
  
  <pre><code>data = open('query-user-by-name.xml').read()
  root = ET.fromstring(data)
  for item in root.iter('ns:value', namespaces):
      print(item.tag)
  </code></pre>
  
  <p>I get the error: </p>
  
  <blockquote>
    <p>TypeError: iter() takes at most 2 arguments (3 given)</p>
  </blockquote>
  
  <p>It seems like I am giving only two arguments and not three. What am I doing wrong to properly iterate through these elements using the namespace?</p>
  
  <p>*Edit: Here is my query-all-users.xml file:</p>
  
  <pre><code>&lt;query xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
          xmlns="http://prism.evolveum.com/xml/ns/public/query-3"&gt;
  &lt;filter&gt;
          &lt;equal&gt;
          &lt;matching&gt;polyStringNorm&lt;/matching&gt;
                  &lt;path&gt;c:name&lt;/path&gt;
                  &lt;value&gt;lilpotter&lt;/value&gt;
          &lt;/equal&gt;
  &lt;/filter&gt;
  &lt;/query&gt;
  </code></pre>