title: convert nested dictionary to file
body: <p>I have a dictionary that I have modified by pulling from a file and modifying values, and now I want to put it back in a file in a similar format.</p>
  
  <p>dictionary is similar to the following:</p>
  
  <pre><code>d={'a':
      {'c':'something else',
       'd':{'e':'some item'}
      },
     'b':
      {'z':'something else',
       's':{'f':'some item'}
      }
    }
  </code></pre>
  
  <p>This is a very long dictionary with nested items and I am guessing I have to use some kind of recursion</p>
  
  <p>I am not sure how to go about this currently so I have no existing code to get from where I am which is a dictionary to a file.</p>
  
  <p>The end result I am trying to get is the following including newlines and spacing:</p>
  
  <pre><code>&lt;a&gt;
      c = something else
      &lt;d&gt;
          e = some item
      &lt;/d&gt;
  &lt;/a&gt;
  &lt;b&gt;
      z = something else
      &lt;s&gt;
          f = some item
      &lt;/s&gt;
  &lt;/b&gt;
  </code></pre>