'Acquire the lock in shared or exclusive mode.
If blocking is False this method will return False if acquiring the
lock failed.'

def acquire(self, blocking=True, shared=False):

    with self._lock:
        if shared:
            return self._acquire_shared(blocking)
        else:
            return self._acquire_exclusive(blocking)
        assert (not (self.is_shared and self.is_exclusive))
