def composekey(*keys):
  """Compose a sequence of keys into one key.

  Example: composekey("attr1.attr2", "attr3") == "attr1.attr2.attr3"
  """
  keys = [key.split() for key in keys]
  composites = [[]]
  for alternatives in keys:
    composites = [com + [alt] for alt in alternatives for com in composites]
  return " ".join(".".join(key) for key in composites)