<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run_once(self):
 """Pump events to this App instance and then return. This works in the way described in :any:`App.run` except it immediately returns after the first :any:`update` call. Having multiple :any:`App` instances and selectively calling runOnce on them is a decent way to create a state machine. """

        if not hasattr(self, '_App__prevTime'):
            self.__prevTime = _time.clock() # initiate __prevTime
        for event in get():
            if event.type: # exclude custom events with a blank type variable
                # call the ev_* methods
                method = 'ev_%s' % event.type # ev_TYPE
                getattr(self, method)(event)
            if event.type == 'KEYDOWN':
                # call the key_* methods
                method = 'key_%s' % event.key # key_KEYNAME
                if hasattr(self, method): # silently exclude undefined methods
                    getattr(self, method)(event)
        newTime = _time.clock()
        self.update(newTime - self.__prevTime)
        self.__prevTime = newTime