def download_url(job, url, work_dir='<STR_LIT:.>', name=None, s3_key_path=None, cghub_key_path=None):
file_path = os.path.join(work_dir, name) if name else os.path.join(work_dir, os.path.basename(url))<EOL>if cghub_key_path:<EOL><INDENT>_download_with_genetorrent(job, url, file_path, cghub_key_path)<EOL><DEDENT>elif urlparse(url).scheme == '<STR_LIT>':<EOL><INDENT>_s3am_with_retry(job, num_cores=<NUM_LIT:1>, file_path=file_path, s3_url=url, mode='<STR_LIT>', s3_key_path=s3_key_path)<EOL><DEDENT>elif urlparse(url).scheme == '<STR_LIT:file>':<EOL><INDENT>shutil.copy(urlparse(url).path, file_path)<EOL><DEDENT>else:<EOL><INDENT>subprocess.check_call(['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:5>', '<STR_LIT>', url, '<STR_LIT>', file_path])<EOL><DEDENT>assert os.path.exists(file_path)<EOL>return file_path<EOL>
Downloads URL, can pass in file://, http://, s3://, or ftp://, gnos://cghub/analysisID, or gnos:///analysisID
If downloading S3 URLs, the S3AM binary must be on the PATH

:param toil.job.Job job: Toil job that is calling this function
:param str url: URL to download from
:param str work_dir: Directory to download file to
:param str name: Name of output file, if None, basename of URL is used
:param str s3_key_path: Path to 32-byte encryption key if url points to S3 file that uses SSE-C
:param str cghub_key_path: Path to cghub key used to download from CGHub.
:return: Path to the downloaded file
:rtype: str