def add(self, event, subscriber, append=True):
subs = self._subscribers<EOL>if event not in subs:<EOL><INDENT>subs[event] = deque([subscriber])<EOL><DEDENT>else:<EOL><INDENT>sq = subs[event]<EOL>if append:<EOL><INDENT>sq.append(subscriber)<EOL><DEDENT>else:<EOL><INDENT>sq.appendleft(subscriber)<EOL><DEDENT><DEDENT>
Add a subscriber for an event.

:param event: The name of an event.
:param subscriber: The subscriber to be added (and called when the
                   event is published).
:param append: Whether to append or prepend the subscriber to an
               existing subscriber list for the event.