def RLock():
    '''
    make the container threadsafe if running in a threaded context
    '''
    if 'thread' in sys.modules:     # thread may be imported either directly or by module threading
        import threading
        return threading.RLock()
    else:
        return _FakeLock

    make the container threadsafe if running in a threaded context
    
recipes/Python/498266_selfcleaning_dictlike_container_which_limits/recipe-498266.py