dictionary transformation
<p>How to map the elements of the lists in the dictionary below to their basic keys (i.e. basic keys are the ones that map to empty lists)</p>

<pre><code>{
'1':[],
'2':[],
'3':['1','2'],
'4':[],
'5':[],
'6':['4','5'],
'7':['3','6']
}
</code></pre>

<p>which would result in</p>

<pre><code>{
'1':[],
'2':[],
'3':{'1':[],'2':[]},
'4':[],
'5':[],
'6':{'4':[],'5':[]},
'7':{'3':{'1':[],'2':[]},'6':{'4':[],'5':[]}}
}
</code></pre>

<p>I think it can be accomplished using a recursive function.</p>