'Return next key press event from the queue, ignoring others.'

def getkeypress(self):

    while 1:
        e = self.get()
        if ((e.type == 'KeyPress') and (e.keycode not in key_modifiers)):
            log(e)
            if (e.keyinfo.keyname == 'next'):
                self.scroll_window(12)
            elif (e.keyinfo.keyname == 'prior'):
                self.scroll_window((-12))
            else:
                return e
        elif ((e.type == 'KeyRelease') and (e.keyinfo == (True, False, False, 83))):
            log(('getKeypress:%s,%s,%s' % (e.keyinfo, e.keycode, e.type)))
            return e
