<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _reap(self):
 """ Reap all processes that have exited. We try to reap bursts of processes so that groups that cluster will tend to restart in the configured order. """

        log = self._params.get('log', self._discard)
        try:
            cnt = len(os.read(self._watch_child, 102400))
            log.debug("%d byte%s read from self-pipe", cnt, ses(cnt))
        except OSError as e:
            if e.errno != errno.EAGAIN:
                log.error("Self-pipe read failed -- %s", e)
        except Exception as e:
            log.error("Self-pipe read failed -- %s", e)
        reaped = False
        while True:
            try:
                (pid, status) = os.waitpid(-1, os.WNOHANG)
            except OSError as e:
                if e.errno == errno.ECHILD:
                    log.debug("No children to wait for")
                    pid = 0
                else:
                    raise e
            if pid > 0:
                reaped = True
                if pid in self._procs:
                    log.debug("Pid %d exited, firing event", pid)
                    self._procs[pid].handle(status)
                    self.proc_del(pid)
                else:
                    log.error("Unknown pid %d %s, ignoring", pid, statusfmt(status))
                continue
            else:
                return reaped