def getboth(dict1, dict2, key, default=None):
 try:
  return dict1[key]
 except KeyError:
  if (default is None):
   return dict2[key]
  else:
   return dict2.get(key, default)

def getboth ( dict1 , dict2 , key , default = None ) : try : return dict1 [ key ] except KeyError : if ( default is None ) : return dict2 [ key ] else : return dict2 . get ( key , default )
try to retrieve key from dict1 if exists .