code: func NewKeyValue(cfg jsonconfig.Obj) (KeyValue, error) {
  	var s KeyValue
  	var err error
  	typ := cfg.RequiredString("type")
  	ctor, ok := ctors[typ]
  	if typ != "" && !ok {
  		return nil, fmt.Errorf("Invalid sorted.KeyValue type %q", typ)
  	}
  	if ok {
  		s, err = ctor(cfg)
  		if err != nil {
  			we, ok := err.(NeedWipeError)
  			if !ok {
  				return nil, fmt.Errorf("error from %q KeyValue: %v", typ, err)
  			}
  			if err := cfg.Validate(); err != nil {
  				return nil, err
  			}
  			we.Msg = fmt.Sprintf("error from %q KeyValue: %v", typ, err)
  			return s, we
  		}
  	}
  	return s, cfg.Validate()
  }
docs: // NewKeyValue returns a KeyValue as defined by cfg.
  // It returns an error of type NeedWipeError when the returned KeyValue should
  // be fixed with Wipe.