function mapTagOperations({
  spec,
  cb = nullFn,
  defaultTag = 'default',
  v2OperationIdCompatibilityMode,
}) {
  const operationIdCounter = {};
  const tagOperations = {}; // Will house all tags + operations
  eachOperation(spec, ({ pathName, method, operation }) => {
    const tags = operation.tags ? normalizeArray(operation.tags) : [defaultTag];

    tags.forEach((tag) => {
      if (typeof tag !== 'string') {
        return;
      }
      tagOperations[tag] = tagOperations[tag] || {};
      const tagObj = tagOperations[tag];
      const id = opId(operation, pathName, method, { v2OperationIdCompatibilityMode });
      const cbResult = cb({
        spec,
        pathName,
        method,
        operation,
        operationId: id,
      });

      if (operationIdCounter[id]) {
        operationIdCounter[id] += 1;
        tagObj[`${id}${operationIdCounter[id]}`] = cbResult;
      } else if (typeof tagObj[id] !== 'undefined') {
        // Bump counter ( for this operationId )
        const originalCounterValue = operationIdCounter[id] || 1;
        operationIdCounter[id] = originalCounterValue + 1;
        // Append _x to the operationId
        tagObj[`${id}${operationIdCounter[id]}`] = cbResult;

        // Rename the first operationId
        const temp = tagObj[id];
        delete tagObj[id];
        tagObj[`${id}${originalCounterValue}`] = temp;
      } else {
        // Assign callback result ( usually a bound function )
        tagObj[id] = cbResult;
      }
    });
  });

  return tagOperations;
}
Iterates over a spec, creating a hash of {[tag]: { [operationId], ... }, ...}
with the value of calling `cb`.

`spec` is a OAI v2.0 compliant specification object
`cb` is called with ({ spec, operation, path, method })
`defaultTag` will house all non-tagged operations