def METHOD_NAME(self):
    """Acquire a write lock. Only one thread can hold this lock, and
    only when no read locks are also held.
    """
    self.monitor.acquire()
    while self.rwlock != 0:
        self.writers_waiting += 1
        self.writers_ok.wait()
        self.writers_waiting -= 1
    self.rwlock = -1
    self.monitor.release()