def METHOD_NAME(
    self, n: int
) -> Generator["defer.Deferred[object]", object, None]:
    "Wait for n writes to have happened"
    while True:
        with self.write_lock:
            if n <= self._number_of_writes:
                return
            if not self._notify_write_deferred:
                self._notify_write_deferred = defer.Deferred()
            d = self._notify_write_deferred
        yield d