ENH: filter events function

a tiny helper to filter events