code: func ValidateInstanceID(iid string, v HashAlgoValidation) (err error) {
  	if len(iid) == 40 {
  		// Legacy SHA1-based instances use hex(sha1) as instance ID, 40 chars.
  		err = checkIsHex(iid)
  	} else {
  		var ref *api.ObjectRef
  		ref, err = decodeObjectRef(iid)
  		if err == nil && v == KnownHash {
  			err = ValidateObjectRef(ref, KnownHash)
  		}
  	}
  	if err == nil {
  		return
  	}
  	return fmt.Errorf("not a valid package instance ID %q - %s", iid, err)
  }
docs: // ValidateInstanceID returns an error if the string isn't a valid instance id.
  //
  // If v is KnownHash, will verify the current version of the code understands
  // the hash algo encoded in idd. Otherwise (if v is AnyHash) will just validate
  // that iid looks syntactically sane, and will accept any hash algo (even if the
  // current code doesn't understand it). This is useful when round-tripping
  // ObjectRefs and instance IDs through the (outdated) client code back to the
  // server.