def split_train_test(pairs, ratio=.7):
  """Given a list of (input, label) pairs, return two separate lists, keeping
     `ratio` of the original data in the first returned list."""
  i = int(len(pairs) * ratio)
  return pairs[:i], pairs[i:]