Dictionary transformation and counter
<p>Object:</p>

<pre><code>data = [{'key': 11, 'country': 'USA'},{'key': 21, 'country': 'Canada'},{'key': 12, 'country': 'USA'}]
</code></pre>

<p>the result should be:</p>

<pre><code>{'USA': {0: {'key':11}, 1: {'key': 12}}, 'Canada': {0: {'key':21}}}
</code></pre>

<p>I started experiment with:</p>

<pre><code>result = {}

for i in data:
    k = 0
    result[i['country']] = dict(k = dict(key=i['key']))
</code></pre>

<p>and I get:</p>

<pre><code> {'Canada': {'k': {'key': 21}}, 'USA': {'k': {'key': 12}}}
</code></pre>

<p>So how can I put the counter instead <code>k</code>? Maybe there is a more elegant way to create the dictionary?</p>
