<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(self):
 """Acquire a lock. This method blocks until the lock is unlocked, then sets it to locked and returns True. """

        if not self._locked and all(w.cancelled() for w in self._waiters):
            self._locked = True
            return True

        fut = self._loop.create_future()

        self._waiters.append(fut)
        try:
            yield from fut
            self._locked = True
            return True
        except asyncio.CancelledError:
            if not self._locked:  # pragma: no cover
                self._wake_up_first()
            raise
        finally:
            self._waiters.remove(fut)