def ensure_lock(lock):
    """Ensure that the given object is a lock."""
    if lock is None or lock is False:
        return DummyLock()
    return lock
Ensure that the given object is a lock.
xarray/backends/locks.py