old_contents: import requests
  from urlparse import urlparse
  
  from six.moves import zip, map
  from six import binary_type
  
  from celery import task
  from celery.contrib.batches import Batches
  from celery import current_app
  
  wot_api_target = "https://api.mywot.com/0.4/public_link_json"
  
  
  @task(base=Batches, flush_every=100, flush_interval=10)
  def wot_malware_scan(requests):
      sig = lambda url: url
      reponses = wot_malware_scan_real(
          (sig(*request.args, **request.kwargs) for request in requests)
      )
      # use mark_as_done to manually return response data
      for response, request in zip(reponses, requests):
          current_app.backend.mark_as_done(request.id, response)
  
  
  def prepare_requests(domains):
      "Insure requests are chopped up to the correct size for the WOT api"
      prepared = list(map(lambda domain: binary_type(domain + '/'), set(domains)))
      while prepared:
          req = binary_type(wot_api_target + "?hosts=")
          while prepared and (len(req) + len(prepared[-1])) <= (8 * 1024):
              req += prepared.pop()
          yield req
  
  
  def wot_malware_scan_real(urls):
      domains = [urlparse(url).netloc for url in urls]
  
      total_response = {}
      for request in prepare_requests(domains):
          total_response.update(requests.get(request).json)
  
      return [total_response[domain] for domain in domains]
  
  
  if __name__ == "__main__":
      print wot_malware_scan_real(("http://google.com", "http://yahoo.com"))
  
new_contents: import requests
  from urlparse import urlparse
  
  from six.moves import zip, map
  from six import binary_type
  
  from celery import task
  from celery.contrib.batches import Batches
  from celery import current_app
  
  wot_api_target = "https://api.mywot.com/0.4/public_link_json"
  
  
  @task(base=Batches, flush_every=100, flush_interval=10)
  def wot_malware_scan(requests):
      sig = lambda url: url
      reponses = wot_malware_scan_real(
          (sig(*request.args, **request.kwargs) for request in requests)
      )
      # use mark_as_done to manually return response data
      for response, request in zip(reponses, requests):
          current_app.backend.mark_as_done(request.id, response)
  
  
  def prepare_requests(domains):
      "ensure requests to the WOT api are less than 8KiB"
      prepared = list(map(lambda domain: binary_type(domain + '/'), set(domains)))
      while prepared:
          req = binary_type(wot_api_target + "?hosts=")
          while prepared and (len(req) + len(prepared[-1])) <= (8 * 1024):
              req += prepared.pop()
          yield req
  
  
  def wot_malware_scan_real(urls):
      domains = [urlparse(url).netloc for url in urls]
  
      total_response = {}
      for request in prepare_requests(domains):
          total_response.update(requests.get(request).json)
  
      return [total_response[domain] for domain in domains]
  
  
  if __name__ == "__main__":
      print wot_malware_scan_real(("http://google.com", "http://yahoo.com"))
  
subject: fix spelling error in prepare_requests docstring