packet = {}
m = re.match(r"Reply from (.*?): bytes=(\d+) time=(\d+)ms TTL=(\d+)", lines[i])
if m:
packet["ip"], packet["bytes"], packet["time"], packet["ttl"] = try_make_ints(m.groups())
packet["connected"] = True
else:
m = re.match("Request timed out.", lines[i])
if m:
packet["connected"] = False
packet["reason"] = "timed out"
else:
m = re.match("Reply from .*?: Destination host unreachable", lines[i])
if m: