import threading

_thread_locals = threading.local()


def set_current_site(site):
    _thread_locals.site = site


def get_current_site():
    return getattr(_thread_locals, "site", None)


def clear_current_site():
    if hasattr(_thread_locals, "site"):
        delattr(_thread_locals, "site")