def uncomposekey(prefix, key):
  """Remove a prefix from a composite key.

  Example: uncomposekey("attr1.attr2", "attr1.attr2.attr3.attr4") == "attr3.attr4"
  """
  if " " in prefix or " " in key:
    raise NotImplementedError()
  prefix, key = prefix.split("."), key.split(".")
  while prefix:
    a, b = prefix.pop(0), key.pop(0)
    if a != b:
      raise ValueError("key %s does not have prefix %s" % (key, prefix))
  return ".".join(key)