title: Dynamic dictionary keys inside formatted string
body: <p>Consider this simplified example of using a dictionary in string formatting:</p>
  <pre><code>template = 'My name is {name}, I am {ages[name]} years old and I am a {occupations[name]}.'
  
  ages = {'name 1': 25, 'name 2:': 22}
  occupations {'name 1': 'programmer', 'name 2': 'mechanic'}
  
  for name in ages.keys():
      print(template.format(ages=ages, occupations=occupations, name=name))
  </code></pre>
  <p>which results in <code>KeyError: 'name'</code></p>
  <p>OK, fair enough, maybe I need</p>
  <pre><code>template = 'My name is {name}, I am {ages[{name}]} years old and I am a {occupations[{name}]}'
  </code></pre>
  <p>But no, <code>KeyError: '{name}'</code></p>
  <p>I know that in this instance I can do</p>
  <pre><code>template = 'My name is {name}, I am {age} years old and I am a {occupation}.'
  (...)
  print(template.format(age=ages[name], occupation=occupations[name], name=name))
  </code></pre>
  <p>Or you can zip the dicts and loop over both the keys and the items, but is there a way to do it more akin to my first example, i.e. supplying the complete dictionaries to <code>.format()</code> that works for any number of dicts?</p>
  <p>In other words: Is there any way to use dynamic keys in a formatted string in Python?</p>