def METHOD_NAME(s3_ds_generator):
    deeplake.constants.LOCKS_ENABLED = True
    try:
        locks = deeplake.core.lock._LOCKS
        refs = deeplake.core.lock._REFS
        nlocks_previous = len(locks)
        def nlocks():
            assert len(locks) == len(refs)
            return len(locks) - nlocks_previous
        ds = s3_ds_generator()
        ds.create_tensor("a")
        assert nlocks() == 1
        ds.__del__()  # Note: investigate why this doesnt happen automatically. (cyclic refs?)
        del ds
        assert nlocks() == 0
        ds = s3_ds_generator()
        ds.create_tensor("x")
        ds.x.extend(np.random.random((2, 32)))
        views = []
        for i in range(32):
            views.append(ds[i : i + 1])
        ds.__del__()
        del ds
        assert nlocks() == 1  # 1 because views
        views[-1].__del__()
        views.pop()
        assert nlocks() == 1  # deleting 1 view doesn't release locks
        for i in range(len(views)):
            views[i].__del__()
        del views
        assert nlocks() == 0  # 0 because dataset and all views deleted
    finally:
        deeplake.constants.LOCKS_ENABLED = False