

def download_one_file(project, file_desc, dest_filename, args):
    if (not args.overwrite):
        if os.path.exists(dest_filename):
            err_exit(fill((('Error: path "' + dest_filename) + '" already exists but -f/--overwrite was not set')))
    if (file_desc['class'] != 'file'):
        print('Skipping non-file data object {name} ({id})'.format(**file_desc), file=sys.stderr)
        return
    if (file_desc['state'] != 'closed'):
        print('Skipping file {name} ({id}) because it is not closed'.format(**file_desc), file=sys.stderr)
        return
    try:
        show_progress = args.show_progress
    except AttributeError:
        show_progress = False
    try:
        dxpy.download_dxfile(file_desc['id'], dest_filename, show_progress=show_progress, project=project)
    except:
        err_exit()

dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/cli/download.py download_one_file/original