Iterating over a hash for a key or value