attenuateModuleHook = async (
  specifier,
  originalModuleRecord,
  policy,
  attenuators,
) => {
  const policyValue = policyLookupHelper(policy, 'builtins', specifier);
  if (!policy || policyValue === true) {
    return originalModuleRecord;
  }

  if (!policyValue) {
    throw Error(
      `Attenuation failed '${specifier}' was not in policy builtins:${q(
        policy.builtins,
      )}`,
    );
  }
  return attenuateModule({
    attenuators,
    attenuationDefinition: policyValue,
    originalModuleRecord,
  });
}
Throws if importing of the specifier is not allowed by the policy

@param {string} specifier - exit module name
@param {import('ses').ThirdPartyStaticModuleInterface} originalModuleRecord - reference to the exit module
@param {PackagePolicy} policy - local compartment policy
@param {DeferredAttenuatorsProvider} attenuators - a key-value where attenuations can be found
@returns {Promise<import('ses').ThirdPartyStaticModuleInterface>} - the attenuated module