You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: sort_ref.go
    path of file: ./repos/gotosocial/vendor/github.com/go-openapi/analysis/internal/flatten/sortref
    
    the code of the file until where you have to start completion: package sortref

import (
	"reflect"
	"sort"
	"strings"

	"github.com/go-openapi/analysis/internal/flatten/normalize"
	"github.com/go-openapi/spec"
)

var depthGroupOrder = []string{
	"sharedParam", "sharedResponse", "sharedOpParam", "opParam", "codeResponse", "defaultResponse", "definition",
}

type mapIterator struct {
	len     int
	mapIter *reflect.MapIter
}

func (i *mapIterator) Next() bool {
	return i.mapIter.Next()
}

func (i *mapIterator) Len() int {
	re
    
func ReverseIndex(schemas map[string]spec.Ref, basePath string) map[string]RefRevIdx {
	collected := make(map[string]RefRevIdx)
	for key, schRef := range schemas {
		// normalize paths before sorting,
		// so we get together keys that are from the same external file
		normalizedPath := normalize.Path(schRef, basePath)

		entry, ok := collected[normalizedPath]
		if ok {
			entry.Keys = append(entry.Keys, key)
			collected[normalizedPath] = entry

			continue
		}

		collected[normalizedPath] = RefRevIdx{
			Ref:  schRef,
			Keys: []string{key},
		}
	}

	return collected
}