import threading
import copy


def deepcopy(obj) -> object:
    """ Thread safe deep copy of an object

    :param obj: the object to deep copy
    :return:
        a deep copy of the object
    """
    lock = threading.Lock()
    with lock:
        return copy.deepcopy(obj)