Main loop

def run(self):
        """Main loop"""
        while True:
            keymap = self._okeymap.get_keymap()
            if keymap == self._last_keymap or not keymap:
                sleep(self._sleep_time)
                continue

            keys = self._okeymap.get_keys(keymap)
            if (keys['regular']
                    and keys['regular'] != self._last_keys['regular']):
                if self._transformer:
                    transformed_keys = self._transformer.transform(keys)
                    if transformed_keys is not None:
                        self._handler.handle(transformed_keys)
                else:
                    self._handler.handle(keys)

            self._last_keymap = keymap
            self._last_keys = keys

            sleep(self._sleep_time)