code: def dnld_file(src_ftp, dst_file, prt=sys.stdout, loading_bar=True):
      
      if os.path.isfile(dst_file):
          return
      do_gunzip = src_ftp[-3:] == '.gz' and dst_file[-3:] != '.gz'
      dst_wget = "{DST}.gz".format(DST=dst_file) if do_gunzip else dst_file
      # Write to stderr, not stdout so this message will be seen when running nosetests
      wget_msg = "wget({SRC} out={DST})\n".format(SRC=src_ftp, DST=dst_wget)
      #### sys.stderr.write("  {WGET}".format(WGET=wget_msg))
      #### if loading_bar:
      ####     loading_bar = wget.bar_adaptive
      try:
          #### wget.download(src_ftp, out=dst_wget, bar=loading_bar)
          rsp = http_get(src_ftp, dst_wget) if src_ftp[:4] == 'http' else ftp_get(src_ftp, dst_wget)
          if do_gunzip:
              if prt is not None:
                  prt.write("  gunzip {FILE}\n".format(FILE=dst_wget))
              gzip_open_to(dst_wget, dst_file)
      except IOError as errmsg:
          import traceback
          traceback.print_exc()
          sys.stderr.write("**FATAL cmd: {WGET}".format(WGET=wget_msg))
          sys.stderr.write("**FATAL msg: {ERR}".format(ERR=str(errmsg)))
          sys.exit(1)
docs: Download specified file if necessary.