docs: def build_on_event(self, runnable, regime, on_event):
          """
          Build OnEvent event handler code.
  
          @param on_event: OnEvent event handler object
          @type on_event: lems.model.dynamics.OnEvent
  
          @return: Generated OnEvent code
          @rtype: list(string)
          """
          on_event_code = []
  
          if self.debug: on_event_code += ['print("Maybe handling something for %s ("+str(id(self))+")")'%(runnable.id),
                            'print("EICs ("+str(id(self))+"): "+str(self.event_in_counters))']
                            
          on_event_code += ['count = self.event_in_counters[\'{0}\']'.\
                            format(on_event.port),
                            'while count > 0:',
                            '    print("  Handling event")' if self.debug else '',
                            '    count -= 1']
          for action in on_event.actions:
              code = self.build_action(runnable, regime, action)
              for line in code:
                  on_event_code += ['    ' + line]
  
          on_event_code += ['self.event_in_counters[\'{0}\'] = 0'.\
                            format(on_event.port),]
  
          return on_event_code