code: def logout(self, sendspec):
  		
  		# Block until background tasks complete.
  		self.wait()
  		shutit = self.shutit
  		shutit.handle_note(sendspec.note,training_input=sendspec.send)
  		if self.login_stack.length() > 0:
  			_ = self.login_stack.pop()
  			if self.login_stack.length() > 0:
  				old_prompt_name	 = self.login_stack.get_current_login_id()
  				self.default_expect = shutit.expect_prompts[old_prompt_name]
  			else:
  				# If none are on the stack, we assume we're going to the root prompt
  				# set up in shutit_setup.py
  				shutit.set_default_shutit_pexpect_session_expect()
  		else:
  			shutit.fail('Logout called without corresponding login', throw_exception=False) # pragma: no cover
  		# No point in checking exit here, the exit code will be
  		# from the previous command from the logged in session
  		echo = shutit.get_echo_override(sendspec.echo)
  		output = self.send_and_get_output(sendspec.send,
  		                                  fail_on_empty_before=False,
  		                                  timeout=sendspec.timeout,
  		                                  echo=echo,
  		                                  loglevel=sendspec.loglevel,
  			                              nonewline=sendspec.nonewline)
  		shutit.handle_note_after(note=sendspec.note)
  		return output
docs: Logs the user out. Assumes that login has been called.
  		If login has never been called, throw an error.
  
  			@param command: Command to run to log out (default=exit)
  			@param note:    See send()