async def key_wait(
        self,
        key_name: str,
        *,
        timeout: Optional[int | float] = None,
        logical_state: bool = False,
        released: bool = False,
        blocking: bool = True,
    ) -> Union[bool, AsyncFutureResult[bool]]:
        """
        Analog for `KeyWait <https://www.autohotkey.com/docs/commands/KeyWait.htm>`_
        """
        options = ''
        if not released:
            options += 'D'
        if logical_state:
            options += 'L'
        if timeout is not None:
            assert timeout >= 0, 'Timeout value must be non-negative'
            options += f'T{timeout}'
        args = [key_name, options]

        resp = await self._transport.function_call('AHKKeyWait', args, blocking=blocking)
        return resp

        Analog for `KeyWait <https://www.autohotkey.com/docs/commands/KeyWait.htm>`_
        
ahk/_async/engine.py