docs: def download_archive(sources):
      """
          Downloads an archive and saves locally (taken from PySMT).
      """
  
      # last element is expected to be the local archive name
      save_to = sources[-1]
  
      # not downloading the file again if it exists
      if os.path.exists(save_to):
          print('not downloading {0} since it exists locally'.format(save_to))
          return
  
      # try all possible sources one by one
      for url in sources[:-1]:
          # make five attempts per source
          for i in range(5):
              # first attempt to get a response
              response = urlopen(url)
  
              # handling redirections
              u = urlopen(response.geturl())
  
              meta = u.info()
              if meta.get('Content-Length') and len(meta.get('Content-Length')) > 0:
                  filesz = int(meta.get('Content-Length'))
                  if os.path.exists(save_to) and os.path.getsize(save_to) == filesz:
                      print('not downloading {0} since it exists locally'.format(save_to))
                      return
  
                  print('downloading: {0} ({1} bytes)...'.format(save_to, filesz), end=' ')
                  with open(save_to, 'wb') as fp:
                      block_sz = 8192
                      while True:
                          buff = u.read(block_sz)
                          if not buff:
                              break
                          fp.write(buff)
  
                  print('done')
                  break
          else:
              continue
  
          break  # successfully got the file
      else:
          assert 0, 'something went wrong -- cannot download {0}'.format(save_to)