assertScopes = (allegedScopes, path, url) => {
  if (allegedScopes === undefined) {
    return;
  }
  const scopes = Object(allegedScopes);
  assert(
    allegedScopes === scopes && !Array.isArray(scopes),
    `${path}.scopes must be an object, got ${q(allegedScopes)} in ${q(url)}`,
  );

  for (const [key, value] of Object.entries(scopes)) {
    assert.typeof(
      key,
      'string',
      `all keys of ${path}.scopes must be strings, got ${key} in ${q(url)}`,
    );
    assertScope(value, `${path}.scopes[${q(key)}]`, url);
  }
}
@param {unknown} allegedScopes
@param {string} path
@param {string} url