title: Remove key and value from nested dictionaries?
body: <p>I have a nested dictionary like this:</p>
  
  <pre><code>book={20:{'start':'2008','reason':'sold'},
        21:{'start':'2009','reason':'returned'},
        22:{'start':'2010','reason':'returned'}}
  </code></pre>
  
  <p>I want to remove items that 'reason'== 'sold' .</p>
  
  <p>The output should be like this:</p>
  
  <pre><code>book={21:{'start':'2009','reason':'returned'},
        22:{'start':'2010','reason':'returned'}}
  </code></pre>
  
  <p>This is my code which is not working:</p>
  
  <pre><code>for k, v in book:
     if v == 'sold':
         del book[k] 
  </code></pre>