<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def acquire_writer(self):
 """ Acquire a write lock, only one thread can hold this lock and only when no read locks are also held. """

        with self.mutex:
            while self.rwlock != 0:
                self._writer_wait()
            self.rwlock = -1