function getScale(nameOrFunction, ctx) {
    if (isString(nameOrFunction)) {
      const maybeScale = ctx.scales[nameOrFunction];
      return maybeScale && isRegisteredScale(maybeScale.value) ? maybeScale.value : undefined;
    } else if (isFunction(nameOrFunction)) {
      return isRegisteredScale(nameOrFunction) ? nameOrFunction : undefined;
    }
    return undefined;
  }
nameOrFunction must be a string or function that was registered.
Return undefined if scale is not recognized.