def METHOD_NAME(transport, expression: str, timeout_sec: int) -> str:
    """Read transport message until it finds the expression."""
    timeout = timeout_sec
    start_time = time.monotonic()
    while True:
        data = _read_line(transport, timeout)
        logging.debug("new line: %s", data)
        if expression in data:
            return data
        timeout = max(0, timeout_sec - (time.monotonic() - start_time))