def observe(self, event, fn):
        """
        Arguments:
            event (str): event to subscribe.
            fn (function|coroutinefunction): function to trigger.

        Raises:
            TypeError: if fn argument is not valid
        """
        iscoroutine = asyncio.iscoroutinefunction(fn)
        if not iscoroutine and not isfunction(fn):
            raise TypeError('paco: fn param must be a callable '
                            'object or coroutine function')

        observers = self._pool.get(event)
        if not observers:
            observers = self._pool[event] = []

        # Register the observer
        observers.append(fn if iscoroutine else coroutine_wrapper(fn))
def observe ( self , event , fn ) : iscoroutine = asyncio . iscoroutinefunction ( fn ) if not iscoroutine and not isfunction ( fn ) : raise TypeError ( 'paco: fn param must be a callable ' 'object or coroutine function' ) observers = self . _pool . get ( event ) if not observers : observers = self . _pool [ event ] = [ ] observers . append ( fn if iscoroutine else coroutine_wrapper ( fn ) )
Arguments:
            event (str): event to subscribe.
            fn (function|coroutinefunction): function to trigger.

        Raises:
            TypeError: if fn argument is not valid