def METHOD_NAME(self, proxy, type_, event, refcon):
    # evenTrap disabled by timeout or user input, re-enable
    if type_ == Quartz.kCGEventTapDisabledByUserInput or \
            type_ == Quartz.kCGEventTapDisabledByTimeout:
        assert self._tap is not None
        Quartz.CGEventTapEnable(self._tap, True)
        return event
    # Convert the Quartz CGEvent into something more useful
    keyEvent = NSEvent.eventWithCGEvent_(event)
    if keyEvent.subtype() == 8: # subtype 8 is media keys
        data = keyEvent.data1()
        keyCode = (data & 0xFFFF0000) >> 16
        keyState = (data & 0xFF00) >> 8
        if keyCode in self._EVENTS:
            if keyState == NSKeyUp:
                self._push_callback(self._EVENTS[keyCode])
            return None # swallow the event, so iTunes doesn't launch
    return event