title: Change default namespace of subelement in lxml
body: <p>I want to generate this xml with <code>lxml</code>:</p>
  
  <pre><code>&lt;aroot xmlns="http://a/">
    &lt;broot xmlns="http://b/" xmlns:a="http://a/">
      &lt;child1/>
      &lt;child2/>
      &lt;a:smalltag1/>
      &lt;a:smalltag2/>
    &lt;/broot>
  &lt;/aroot>
  </code></pre>
  
  <p>But the following code (that seems to be correct for this output), does not generates above xml.</p>
  
  <pre><code>from lxml import etree
  from lxml.builder import ElementMaker
  
  NS_A = 'http://a/'
  NS_B = 'http://b/'
  
  A = ElementMaker(namespace=NS_A, nsmap={None: NS_A, 'b': NS_B})
  B = ElementMaker(namespace=NS_B, nsmap={None: NS_B, 'a': NS_A})
  
  elem = A.aroot(
      B.broot(
          B.child1,
          B.child2,
          A.smalltag1,
          A.smalltag2,
      ),
  )
  
  print(etree.tostring(elem, pretty_print=True).decode('ascii'))
  </code></pre>
  
  <p>This generates:</p>
  
  <pre><code>&lt;aroot xmlns:b="http://b/" xmlns="http://a/">
    &lt;b:broot>
      &lt;b:child1/>
      &lt;b:child2/>
      &lt;smalltag1/>
      &lt;smalltag1/>
    &lt;/b:broot>
  &lt;/aroot>
  </code></pre>
  
  <p>This is a valid xml, but I cannot change the default namespace on subelemnt <code>broot</code>.</p>
  
  <p>If I change the <code>A</code> <code>ElementMaker</code> as following:</p>
  
  <pre><code>A = ElementMaker(namespace=NS_A, nsmap={None: NS_A})
  </code></pre>
  
  <p>The output becomes:</p>
  
  <pre><code>&lt;aroot xmlns="http://a/"&gt;
    &lt;broot xmlns="http://b/"&gt;
      &lt;child1/&gt;
      &lt;child2/&gt;
      &lt;smalltag1/&gt;
      &lt;smalltag2/&gt;
    &lt;/broot&gt;
  &lt;/aroot&gt;
  </code></pre>
  
  <p>which is an invalid xml (namespace of <code>smalltag1</code> is now b)</p>
  
  <p>and if I change both <code>A</code> and <code>B</code> as follows:</p>
  
  <pre><code>A = ElementMaker(namespace=NS_A, nsmap={None: NS_A})
  B = ElementMaker(namespace=NS_B, nsmap={None: NS_B})
  </code></pre>
  
  <p>the output is:</p>
  
  <pre><code>&lt;aroot xmlns="http://a/"&gt;
    &lt;broot xmlns="http://b/"&gt;
      &lt;child1/&gt;
      &lt;child2/&gt;
      &lt;smalltag1 xmlns="http://a/"/&gt;
      &lt;smalltag2 xmlns="http://a/"/&gt;
    &lt;/broot&gt;
  &lt;/aroot&gt;
  </code></pre>
  
  <p>Which is valid, but not desired output.</p>