def handler(self, direction, verb, priority=<NUM_LIT:10>):
def parent_fn(func):<EOL><INDENT>@functools.wraps(func)<EOL>def child_fn(msg):<EOL><INDENT>func(msg)<EOL><DEDENT>self.register_event(direction, verb, child_fn, priority=priority)<EOL>return child_fn<EOL><DEDENT>return parent_fn<EOL>
Register this function as an event handler.

        Args:
            direction (str): ``in``, ``out``, ``both``, ``raw``.
            verb (str): Event name.
            priority (int): Handler priority (lower priority executes first).

        Example:
            These handlers print out a pretty raw log::

                reactor = girc.Reactor()

                @reactor.handler('in', 'raw', priority=1)
                def handle_raw_in(event):
                    print(event['server'].name, ' ->', escape(event['data']))


                @reactor.handler('out', 'raw', priority=1)
                def handle_raw_out(event):
                    print(event['server'].name, '<- ', escape(event['data']))