old_contents: import requests
  import zipfile
  import cStringIO as StringIO
  import csv
  
  
  def alexa_top_million():
      return csv.DictReader(
          zipfile.ZipFile(
              StringIO.StringIO(
                  requests.get("http://s3.amazonaws.com/alexa-static/top-1m.csv.zip").content
              )
          ).open("top-1m.csv"),
          fieldnames=("score", "domain")
      )
  
new_contents: import requests
  import zipfile
  import cStringIO as StringIO
  import csv
  
  
  def alexa_top_million():
      """Returns a list of objects describing the top million domains from Alexa
      It turns out this list can be used as a set and held in memory fairly
      easily:
  
      domains = frozenset({item["domain"] for item in alexa_top_million()})
      if "google.com" in domains:
          return u"safe"
  
      However it might be better to stick this in a *real* database local to
      each worker, and update it each day. Might as well use the Redis DB we
      have lying around. It might be even better to have a BloomFilter before
      even bothering to check the DB.
      """
      return csv.DictReader(
          zipfile.ZipFile(
              StringIO.StringIO(
                  requests.get("http://s3.amazonaws.com/alexa-static/top-1m.csv.zip").content
              )
          ).open("top-1m.csv"),
          fieldnames=("score", "domain")
      )
  
subject: document alexa_top_million