def _check_for_fail_message(self, transport, exc_info, timeout):  # pylint: disable=no-self-use
    """Check for a 'FAIL' message from transport.

    This method always raises, if 'FAIL' was read, it will raise an
    AdbRemoteError with the message, otherwise it will raise based on
    exc_info, which should be a tuple as per sys.exc_info().

    Args:
      transport: Transport from which to read for a 'FAIL' message.
      exc_info: Exception info to raise if no 'FAIL' is read.
      timeout: Timeout to use for the read operation.

    Raises:
      AdbRemoteError: If a 'FAIL' is read, otherwise raises exc_info.
    """
    try:
      transport.read_message(timeout)
    except usb_exceptions.CommonUsbError:
      # If we got a remote error, raise that exception.
      if sys.exc_info()[0] is usb_exceptions.AdbRemoteError:
        raise
    # Otherwise reraise the original exception.
    raise_with_traceback(exc_info[0](exc_info[1]), traceback=exc_info[2])