Acquire the lock in shared or exclusive mode.

def acquire(self,blocking=True,timeout=None,shared=False):
        """Acquire the lock in shared or exclusive mode."""
        with self._lock:
            if shared:
                self._acquire_shared(blocking,timeout)
            else:
                self._acquire_exclusive(blocking,timeout)
            assert not (self.is_shared and self.is_exclusive)