function getSassImplementation(loaderContext, implementation) {
  let resolvedImplementation = implementation;

  if (!resolvedImplementation) {
    resolvedImplementation = getDefaultSassImplementation();
  }

  if (typeof resolvedImplementation === "string") {
    // eslint-disable-next-line import/no-dynamic-require, global-require
    resolvedImplementation = require(resolvedImplementation);
  }

  const { info } = resolvedImplementation;

  if (!info) {
    throw new Error("Unknown Sass implementation.");
  }

  const infoParts = info.split("\t");

  if (infoParts.length < 2) {
    throw new Error(`Unknown Sass implementation "${info}".`);
  }

  const [implementationName] = infoParts;

  if (implementationName === "dart-sass") {
    // eslint-disable-next-line consistent-return
    return resolvedImplementation;
  } else if (implementationName === "node-sass") {
    // eslint-disable-next-line consistent-return
    return resolvedImplementation;
  } else if (implementationName === "sass-embedded") {
    // eslint-disable-next-line consistent-return
    return resolvedImplementation;
  }

  throw new Error(`Unknown Sass implementation "${implementationName}".`);
}
This function is not Webpack-specific and can be used by tools wishing to mimic `sass-loader`'s behaviour, so its signature should not be changed.