assertCompartments = (allegedCompartments, url) => {
  const compartments = Object(allegedCompartments);
  assert(
    allegedCompartments === compartments || !Array.isArray(compartments),
    `compartments must be an object, got ${q(allegedCompartments)} in ${q(
      url,
    )}`,
  );
  for (const [key, value] of Object.entries(compartments)) {
    assertCompartment(value, `compartments[${q(key)}]`, url);
  }
}
@param {unknown} allegedCompartments
@param {string} url