<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _event_register(self, control):
 """ Do all necessary event registration with the legion for events listed in the pending config. The default event action is to stop the task. """

        log = self._params.get('log', self._discard)
        if 'events' not in self._config_running:
            log.debug("No events present for task '%s'", self._name)
            return
        for event in self._config_running['events']:
            ev_type = self._get(event.get('type'))
            if not ev_type:
                log.error("Ignoring event in task '%s' with no type", self._name)
                continue
            ev = self._make_event_target(event, control)
            if ev is None:
                continue
            log.debug("Adding event type '%s' for task '%s'", ev_type, self._name)
            if ev_type == 'self':
                self._legion.file_add(ev, self.get_path())
            elif ev_type == 'python':
                self._legion.module_add(ev, path=self.get_path())
            elif ev_type == 'file_change':
                path = self._get_list(event.get('path'))
                if path:
                    self._legion.file_add(ev, _fmt_context(path, self._context))
                else:
                    log.error("Ignoring %s event in task '%s' with no path", ev_type, self._name)
            elif ev_type in ['stop', 'restart']:
                log.debug("No task '%s' registration action for '%s' event", self._name, ev_type)
            else:
                log.error("Ignoring unknown event type '%s' in task '%s'", ev_type, self._name)