def extract_triplets(s):
  """
  given a string s of the form "a:b:c:d:e:f...", extract triplets
  [('a', 'b', 'c'), ('d', 'e', 'f')]
  """
  t = s.split(':')
  assert len(t) % 3 == 0
  result = []
  while len(t) > 0:
    result.append((t[0], t[1], t[2]))
    t = t[3:]
  return result