you can just do: `if 'close' in d:` here, since dict.__contains__ tests for key presence:

```
>>> {"foo":"bar"}.__contains__("foo")
True
```