<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_listener(self, event, callback, single=False, priority=1):
 """ Add a callback to an event list so it will be run at this event's firing. If single is True, the event is auto-removed after the first invocation. Priority can be used to jump ahead or behind other callback invocations."""

        event_stack = self._events[event]
        event_stack.append({
            "callback": callback,
            "single": single,
            "priority": priority
        })
        event_stack.sort(key=lambda x: x['priority'])