<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _add_pending_action(self, p_action, p_size):
 """ Creates action waiting for execution and forwards it to the mainloop. """

        def generate_callback():
            def callback(*args):
                self.resolve_action(p_action, p_size)
                self.keystate = None

            return callback

        urwid.emit_signal(self, 'add_pending_action', generate_callback())