title: How to create xml in python
body: <p>Good day.</p>
  <p>I am trying to make xml document with python.</p>
  <p>Here is part of the code:</p>
  <pre><code>productChild = root.createElement('product') 
  setproduct = ‘Shoe’
  productChild.setAttribute(setproduct)
  </code></pre>
  <p>And this will output</p>
  <pre><code>&lt;product&gt;Shoe&lt;/product&gt;
  </code></pre>
  <p>My question is:
  How can make it if setproduct is empty the tag to be <code>&lt;product/&gt;</code> and not <code>&lt;product&gt;&lt;/product&gt;</code></p>