Fix Event.as_json to prevent mutation of `Event` (#35)
Fix Event.as_json to prevent mutation of `Event` (#35)

Currently, If I try to get an `Event` as json, then the event will thereafter have the `event.when['object']` removed.  e.g.

```py
event = client.events.find(event_id)
print(event.when['object'])
json_event = event.as_json()
print(event.when['object'])  # KeyError!  Snap!
```

* Also, I decided to use `dict.pop(key, None)` instead of `if key in d: del d[key]` because it looks nicer (IMHO)
* and `if d.get(key)` rather than `if key in d` since the first one will work as we expect if `d[key] == None` whereas the latter won't.
nylas/nylas-python