import threading
import time

class Sleeper(object):
    def __init__(self, sleep_func):
        self.sleep = sleep_func

    def __del__(self):
        self.sleep(1)

def thread_func():
    sleeper = Sleeper(time.sleep)
    a = 1
    while True:
        a += 1

thread = threading.Thread(target=thread_func)
thread.setDaemon(True)
thread.start()
