def cleanup_subprocesses():
    """On python exit: find possibly running subprocesses and kill them."""
    # pylint: disable=redefined-outer-name, reimported
    # atexit functions tends to loose global imports sometimes so reimport
    # everything what is needed again here:
    import os
    import errno
    from mirakuru.base_env import processes_with_env
    from mirakuru.compat import SIGKILL

    pids = processes_with_env(ENV_UUID, str(os.getpid()))
    for pid in pids:
        try:
            os.kill(pid, SIGKILL)
        except OSError as err:
            if err.errno != errno.ESRCH:
                print("Can not kill the", pid, "leaked process", err)
On python exit: find possibly running subprocesses and kill them.