code: func CheckEnvironmentTargetedCorrectly(targetedOrganizationRequired bool, targetedSpaceRequired bool, testOrg string, command ...string) {
  	LoginCF()
  
  	if targetedOrganizationRequired {
  		By("errors if org is not targeted")
  		session := CF(command...)
  		Eventually(session).Should(Say("FAILED"))
  		Eventually(session.Err).Should(Say("No org targeted, use 'cf target -o ORG' to target an org\\."))
  		Eventually(session).Should(Exit(1))
  
  		if targetedSpaceRequired {
  			By("errors if space is not targeted")
  			TargetOrg(testOrg)
  			session := CF(command...)
  			Eventually(session).Should(Say("FAILED"))
  			Eventually(session.Err).Should(Say("No space targeted, use 'cf target -s SPACE' to target a space\\."))
  			Eventually(session).Should(Exit(1))
  		}
  	}
  
  	By("errors if user not logged in")
  	LogoutCF()
  	session := CF(command...)
  	Eventually(session).Should(Say("FAILED"))
  	Eventually(session.Err).Should(Say("Not logged in\\. Use 'cf login' to log in\\."))
  	Eventually(session).Should(Exit(1))
  
  	By("errors if cli not targeted")
  	UnsetAPI()
  	session = CF(command...)
  	Eventually(session).Should(Say("FAILED"))
  	Eventually(session.Err).Should(Say("No API endpoint set\\. Use 'cf login' or 'cf api' to target an endpoint\\."))
  	Eventually(session).Should(Exit(1))
  }
docs: // CheckEnvironmentTargetedCorrectly will confirm if the command requires an
  // API to be targeted and logged in to run. It can optionally check if the
  // command requires org and space to be targeted.