title: Returning specific key(s) and its value from a dictionary
body: <p>I'm writing a function where I need to analyze a dictionary and pull out one of the keys and all of its values and return it.</p>
  
  <p>Example dictionary:</p>
  
  <pre><code>{'P':[("Eight",1460, 225.0, 200.0, "fresco","Netherlands"),
        ("Six",1465,81.0, 127.1, "tempera", "Netherlands")],
   'V':[("Four",1661, 148.0, 257.0,"oil paint", "Austria"),
        ("Two",1630, 91.0, 77.0, "oil paint","USA")],
   'K':[("Five",1922,63.8,48.1,"watercolor","USA"),
        ("Seven",1950,61.0,61.0,"acrylic paint","USA"),
        ("Two",1965,81.3,100.3,"oil paint","United Kingdom")],
   'C':[("Ten",1496,365.0,389.0,"tempera","Italy")],
   'U':[("Nine",1203,182.0, 957.0,"egg tempera","Italy"),
        ("Twelve",1200,76.2,101.6,"egg tempera","France")]}
  </code></pre>
  
  <p>So if my function is called find_the_key and I was looking for 'C' and its value then it would need to return</p>
  
  <pre><code>find_the_key(dictionary2(),['C'])
  
  return {'C': [('Ten', 1496, 365.0, 389.0, 'tempera','Italy')]}
  </code></pre>
  
  <p>If it needed to find both 'C' and 'V' it would return</p>
  
  <pre><code>find_the_key(dictionary2(),['C','V'])
  
  return {'C': [('Ten', 1496, 365.0, 389.0, 'tempera', 'Italy')], 'V': [('Four',
  1661, 148.0, 257.0, 'oil paint', 'Austria'), ('Two', 1630, 91.0, 77.0, 'oil
  paint', 'USA')]}
  </code></pre>
  
  <p>I've done some research on extracting a key from a dictionary and my current code could be close.</p>
  
  <pre><code>def find_the_key(dictionary,thekey):
      for thekey in dictionary.keys():
        if dictionary[thekey] == targetkey:
          return key, targetkey
  </code></pre>
  
  <p>Currently I'm getting the error targetkey is not defined though I think my logic is on the right track. Does anyone have any idea how to do this?</p>