def dispatch(self, obj, event, delay=0, *args):
        if delay:
            logger.info(
                        'Delayed dispatching. '
                        'Delay: %d, Object: %s, State: %s, Event: %s',
                        delay, obj, self.state_to_name(self.state),
                        self.event_to_name(event)
                       )
            reactor.callLater(delay, self.dispatch, obj, event, delay=0, *args)
            return

        logger.info('Dispatching. Object: %s, State: %s, Event: %s',
                    obj, self.state_to_name(self.state),
                    self.event_to_name(event))
        try:
            (state, function) = self.transitions[self.state, event]
        except __HOLE__:
            (state, function) = self.transitions[None, event]

        logger.info('New state: %s, Function: %s, delay=%d',
                    self.state_to_name(state), function, delay)
        if state:
            self.state = state

        if callable(function):
            reactor.callLater(0, function, *args)
        elif function:
            # this will return bound method of the obj
            function = getattr(obj, function)
            reactor.callLater(0, function, *args)
        else:
            logger.info('Injecting new event EV_NEXT for object: %s', obj)
            reactor.callLater(0, self.dispatch, obj, self.EV_NEXT)
dataset/ETHPy150Open facebook/fbpush/fbpush/main.py/FSM.dispatch