title: Fast hostname/IP check in Python?
body: <p>I have a list of hostnames and I want to check if these machines are running or not in an interval of about one second.</p>
  
  <p>What I have until now is this, but the timeout on the machines which are offline take some seconds:</p>
  
  <pre><code>socket.setdefaulttimeout(0)
  def resolve_hostname(hostname):
      try:
          return socket.gethostbyname(hostname)
      except socket.error:
          return False
  </code></pre>
  
  <p>Not good as the list has about 30 machines.</p>
  
  <p>Any ideas how to speed things up a bit?</p>
  
  <p>Thank you!</p>