ModemATCommandLink: improve response time for "+CME ERROR"

Change-Id: I41af33c1898f5ed3d1c5238e45f956c6ceab2826
diff --git a/pySim/transport/modem_atcmd.py b/pySim/transport/modem_atcmd.py
index 3d39a20..04f9221 100644
--- a/pySim/transport/modem_atcmd.py
+++ b/pySim/transport/modem_atcmd.py
@@ -67,12 +67,16 @@
 		t_start = time.time()
 		while True:
 			rsp = rsp + self._sl.read(self._sl.in_waiting)
-			if rsp.endswith(b'OK\r\n'):
-				log.debug('Command finished with result: OK')
-				break
-			if rsp.endswith(b'ERROR\r\n'):
-				log.error('Command finished with result: ERROR')
-				break
+			lines = rsp.split(b'\r\n')
+			if len(lines) >= 2:
+				res = lines[-2]
+				if res == b'OK':
+					log.debug('Command finished with result: %s', res)
+					break
+				if res == b'ERROR' or res.startswith(b'+CME ERROR:'):
+					log.error('Command failed with result: %s', res)
+					break
+
 			if time.time() - t_start >= timeout:
 				log.info('Command finished with timeout >= %ss', timeout)
 				break