code: func (actor Actor) PollPackage(pkg Package) (Package, Warnings, error) {
  	var allWarnings Warnings
  
  	for pkg.State != constant.PackageReady && pkg.State != constant.PackageFailed && pkg.State != constant.PackageExpired {
  		time.Sleep(actor.Config.PollingInterval())
  		ccPkg, warnings, err := actor.CloudControllerClient.GetPackage(pkg.GUID)
  		log.WithFields(log.Fields{
  			"package_guid": pkg.GUID,
  			"state":        pkg.State,
  		}).Debug("polling package state")
  
  		allWarnings = append(allWarnings, warnings...)
  		if err != nil {
  			return Package{}, allWarnings, err
  		}
  
  		pkg = Package(ccPkg)
  	}
  
  	if pkg.State == constant.PackageFailed {
  		return Package{}, allWarnings, actionerror.PackageProcessingFailedError{}
  	} else if pkg.State == constant.PackageExpired {
  		return Package{}, allWarnings, actionerror.PackageProcessingExpiredError{}
  	}
  
  	return pkg, allWarnings, nil
  }
docs: // PollPackage returns a package of an app.