title: Use python function to get key by value in dictionary and return either key or "None'
body: <p>I am trying to return only the key value '20' but instead my function returns 'None'. I only want it to return None if value is not in my input dictionary.</p>
  <pre><code>def find_key(input_dict, value):
  for key,val in input_dict.items():
      if val == value:
         return key
      else: 
          return &quot;None&quot;
  
  find_key({100:'a', 20:'b', 3:'c', 400:'d'}, 'b')
  </code></pre>