def apply(self, event, document, *args, **kwargs):
for fn in self._handler_dict.get(event, []):<EOL><INDENT>fn(document, *args, **kwargs)<EOL><DEDENT>
Applies all middleware functions registered against the given
event in order to the given document.