Handle a keypress. Concrete subclasses can implement this method if
        custom keypresses need to be handled other than for exit and scrolling.

def handle_key(self, key):
        """
        Handle a keypress. Concrete subclasses can implement this method if
        custom keypresses need to be handled other than for exit and scrolling.
        """
        try:
            func = None
            if key.is_sequence:
                try:
                    func = self.config.keymap[key.name]
                except:
                    try:
                        func = self.config.keymap[key.code]
                    except:
                        func = self.config.keymap[str(key)]
            else:
                func = self.config.keymap[str(key)]

            if func in self.valid_key_funcs:
                getattr(self, func)()
        except:
            raise