import re


def getKeepAlive(response):
  """Extracts and returns the keep alive token from the response.

  Extracts and returns the actual keep-alive token from within the response;
  this token enables subsequent requests for CSV data.

  Args:
      response: The Python requests response object, typically corresponding to
                a simple GET request on the main refugee explorer page.

  Returns:
      A keep-alive token which is used to validate subsequent requests.

  Raises:
      AssertionError: Could not extract a single keep-alive token from the page.
  """
  controlId = re.findall('ControlID=([a-fA-F0-9]+)"', response.text)
  assert len(controlId) == 1, 'Multiple or no tokens should not happen'
  return controlId[0]