Just don't call keys, for instance try this:
if 'key1' in dict:
print "Y"
else:
print "N"
Alternatively You can also use, in operator to test the existence of a key in a dict. Ex.
r = {'q': 2, 'w': 3}
'q' in r # <== evaluates to True
'e' in r # <== evaluates to False
It's the fastest way to perform the task.
Don't feel shy to ask your doubt in comment. Happy Learning.