Print diff of Python dictionaries
<p>I want to take two dictionaries and print a diff of them.  This diff should include the differences in keys AND values.  I've created this little snippet to achieve the results using built-in code in the <code>unittest</code> module.  However, it's a nasty hack since I have to subclass <code>unittest.TestCase</code> and provide a <code>runtest()</code> method for it to work.  In addition, this code will cause the application to error out since it will raise an <code>AssertError</code> when there are differences.  All I really want is to print the diff.</p>

<pre><code>import unittest
class tmp(unittest.TestCase):
    def __init__(self):
         # Show full diff of objects (dicts could be HUGE and output truncated)
        self.maxDiff = None
    def runTest():
        pass
_ = tmp()
_.assertDictEqual(d1, d2)
</code></pre>

<p>I was hoping to use the <code>difflib</code> module, but it looks to only work for strings.  Is there some way to work around this and still use <code>difflib</code>?</p>
