title: Multiple expect in pexpect
body: <p>I am writing a code to automate testing using Pexpect
  So basically Telnet into a system and send commands.
  I have spawned a child for it. And I pass the child to function. Is it pass by reference or pass by value?</p>
  
  <pre><code>def test(child,clicommand,min,max,message):
      child.sendline("xyz")
      """Basically I am sending only sendline But I need 2 more expects. 
      Because of two execute called before this method.
      Both the expects are not blocking and the execute"""
      child.expect("() &gt;")
      child.expect("() &gt;")
      child.expect("() &gt;")
      return
  
  
  def execute(child,clicommand):
      print "Executing CLI command: "+clicommand
      child.sendline(clicommand)
      child.expect("() &gt;")
      return
  
  
  child = pexpect.spawn("telnet xx.xx.xx.xx xxxx")
  child.sendline("")
  child.expect("() &gt;")
  execute(child,"abc")
  execute(child,"abc")
  test(child,"xyz",1,2,"Error")
  </code></pre>
  
  <p>So are the expects being buffered or lined up? How Can I make it asynchronous?
  I even tried try except, but no exceptions are thrown</p>