Use modern api to check if event is set.

Since we are a python2.6+ code base now, we want to be as forward
compatible as possible.