old_contents: from subprocess import check_output, STDOUT
  
  def ping(host, count=4, deadline=None):
      """Tries to ping "host". Returns True if all request packets recieve a
         a reply and False otherwise."""
      cmd = ["ping", "-c", str(count)]
      if deadline:
          cmd += ["-w", str(deadline)]
      cmd += [host]
      for line in check_output(cmd, stderr=STDOUT):
          if "0% packet loss" in line:
              return True
      return False
  
new_contents: from subprocess import check_output, STDOUT, CalledProcessError
  
  def ping(host, count=4, deadline=None):
      """Tries to ping "host". Returns True if all request packets recieve a
         a reply and False otherwise."""
      cmd = ["ping", "-c", str(count)]
      if deadline:
          cmd += ["-w", str(deadline)]
      cmd += [host]
      try:
          output = check_output(cmd, stderr=STDOUT)
      except CalledProcessError, e:
          output = e.output
      for line in output:
          if "0% packet loss" in line:
              return True
      return False
  
subject: Fix ping method.