code: def config_download(config):
      
      try:
          download_candidates = select_candidates(config)
  
          if len(download_candidates) < 1:
              logging.error("No downloads matched your filter. Please check your options.")
              return 1
  
          if config.dry_run:
              print("Considering the following {} assemblies for download:".format(len(download_candidates)))
              for entry, _ in download_candidates:
                  print(entry['assembly_accession'], entry['organism_name'], sep="\t")
  
              return 0
  
          download_jobs = []
          for entry, group in download_candidates:
              download_jobs.extend(create_downloadjob(entry, group, config))
  
          if config.parallel == 1:
              for dl_job in download_jobs:
                  worker(dl_job)
          else:  # pragma: no cover
              # Testing multiprocessing code is annoying
              pool = Pool(processes=config.parallel)
              jobs = pool.map_async(worker, download_jobs)
              try:
                  # 0xFFFF is just "a really long time"
                  jobs.get(0xFFFF)
              except KeyboardInterrupt:
                  # TODO: Actually test this once I figure out how to do this in py.test
                  logging.error("Interrupted by user")
                  return 1
  
          if config.metadata_table:
              with codecs.open(config.metadata_table, mode='w', encoding='utf-8') as handle:
                  table = metadata.get()
                  table.write(handle)
  
      except requests.exceptions.ConnectionError as err:
          logging.error('Download from NCBI failed: %r', err)
          # Exit code 75 meas TEMPFAIL in C/C++, so let's stick with that for now.
          return 75
      return 0
docs: Run the actual download from NCBI with parameters in a config object.
  
      Parameters
      ----------
          config: NgdConfig
              A configuration object with the download settings
  
      Returns
      -------
      int
          success code