'Kill all BG processes which are still running.'

def kill_bg_processes(self):

    if (not self.bg_processes):
        return
    for p in self.bg_processes:
        if (p.poll() is None):
            try:
                p.send_signal(signal.SIGINT)
            except:
                pass
    time.sleep(0.1)
    self._gc_bg_processes()
    if (not self.bg_processes):
        return
    for p in self.bg_processes:
        if (p.poll() is None):
            try:
                p.terminate()
            except:
                pass
    time.sleep(0.1)
    self._gc_bg_processes()
    if (not self.bg_processes):
        return
    for p in self.bg_processes:
        if (p.poll() is None):
            try:
                p.kill()
            except:
                pass
    self._gc_bg_processes()
