docs: def expect(self,
  	           expect,
  	           searchwindowsize=None,
  	           maxread=None,
  	           timeout=None,
  	           iteration_n=1):
  		"""Handle child expects, with EOF and TIMEOUT handled
  
  		iteration_n - Number of times this expect has been called for the send.
  		              If 1, (the default) then it gets added to the pane of output
  		              (if applicable to this run)
  		"""
  		if isinstance(expect, str):
  			expect = [expect]
  		if searchwindowsize != None:
  			old_searchwindowsize = self.pexpect_child.searchwindowsize
  			self.pexpect_child.searchwindowsize = searchwindowsize
  		if maxread != None:
  			old_maxread = self.pexpect_child.maxread
  			self.pexpect_child.maxread = maxread
  		res = self.pexpect_child.expect(expect + [pexpect.TIMEOUT] + [pexpect.EOF], timeout=timeout)
  		if searchwindowsize != None:
  			self.pexpect_child.searchwindowsize = old_searchwindowsize
  		if maxread != None:
  			self.pexpect_child.maxread = old_maxread
  		# Add to session lines only if pane manager exists.
  		if shutit_global.shutit_global_object.pane_manager and iteration_n == 1:
  			time_seen = time.time()
  			lines_to_add = []
  			if isinstance(self.pexpect_child.before, (str,unicode)):
  				for line_str in self.pexpect_child.before.split('\n'):
  					lines_to_add.append(line_str)
  			if isinstance(self.pexpect_child.after, (str,unicode)):
  				for line_str in self.pexpect_child.after.split('\n'):
  					lines_to_add.append(line_str)
  			# If first or last line is empty, remove it.
  			#if len(lines_to_add) > 0 and lines_to_add[1] == '':
  			#	lines_to_add = lines_to_add[1:]
  			#if len(lines_to_add) > 0 and lines_to_add[-1] == '':
  			#	lines_to_add = lines_to_add[:-1]
  			for line in lines_to_add:
  				self.session_output_lines.append(SessionPaneLine(line_str=line, time_seen=time_seen, line_type='output'))
  		return res