title: Comparing and updating nested dictionaries python
body: <p>I tried finding many places , but could not find same one, please help in this python code.
  I have three nested multi level dictionaries, two main (A and B) and one small (temp)</p>
  <pre><code>A={&quot;X&quot;:{&quot;XX&quot;:1,&quot;XX1&quot;:56},&quot;Y&quot;:{&quot;YY&quot;:2},&quot;Z&quot;:{&quot;ZZ&quot;:{&quot;ZA&quot;:34,&quot;ZB&quot;:35}}
  
  B={&quot;X&quot;:{&quot;XX&quot;:2,&quot;XX1&quot;:34},&quot;L&quot;:{&quot;LL&quot;:3},&quot;Z&quot;:{&quot;ZZ&quot;:{&quot;ZA&quot;:31,&quot;ZB&quot;:38}}
  
  temp={&quot;X&quot;:{&quot;XX&quot;:1},&quot;Z&quot;:{&quot;ZZ&quot;:{&quot;ZA&quot;:34}}
  </code></pre>
  <p>If values of &quot;temp&quot; matches &quot;A&quot; then update &quot;A&quot; and &quot;B&quot; by deleting that entire record.
  So, final A and B should be</p>
  <pre><code>A={&quot;X&quot;:{&quot;XX1&quot;:56},&quot;Y&quot;:{&quot;YY&quot;:2},&quot;Z&quot;:{&quot;ZZ&quot;:{&quot;ZB&quot;:35}}
  B={&quot;X&quot;:{&quot;XX1&quot;:34},&quot;L&quot;:{&quot;LL&quot;:3},&quot;Z&quot;:{&quot;ZZ&quot;:{&quot;ZB&quot;:38}}
  </code></pre>