def process_expect_log(logfile):
  """Process expect script log file to get requests and responses.

  Return a pair of lists of requests and responses
  """
  requests = []
  responses = []
  request_marker = "Please scan the QR-Code using the red scanner"
  response_marker = "Displaying QR code. Data: "
  with open(logfile, 'r') as f:
    lines = f.readlines()
    for i in range(0, len(lines)):
      if lines[i].startswith(request_marker):
        requests.append(lines[i+1].strip())
        i = i + 1
      elif lines[i].startswith(response_marker):
        responses.append(lines[i][len(response_marker) : ].strip())      
  assert len(requests) == len(responses), "Number of requests does not match number of responses"
  return (requests, responses)