def PyMapping_HasKey(space, w_obj, w_key):
    """Return 1 if the mapping object has the key key and 0 otherwise.
    This is equivalent to o[key], returning True on success and False
    on an exception.  This function always succeeds."""
    try:
        space.getitem(w_obj, w_key)
        return 1
    except:
        return 0