code: func InstanceIDToObjectRef(iid string) *api.ObjectRef {
  	// Legacy SHA1-based instances use hex(sha1) as instance ID, 40 chars.
  	if len(iid) == 40 {
  		if err := checkIsHex(iid); err != nil {
  			panic(fmt.Errorf("not a valid package instance ID %q - %s", iid, err))
  		}
  		return &api.ObjectRef{
  			HashAlgo:  api.HashAlgo_SHA1,
  			HexDigest: iid,
  		}
  	}
  	ref, err := decodeObjectRef(iid)
  	if err != nil {
  		panic(fmt.Errorf("not a valid package instance ID %q - %s", iid, err))
  	}
  	return ref
  }
docs: // InstanceIDToObjectRef is a reverse of ObjectRefToInstanceID.
  //
  // Panics if the instance ID is incorrect. Use ValidateInstanceID if
  // this is a concern.