code: def dl_pb_file(inputs):
      
  
      basefile, subdir, db, dl_dir, keep_subdirs, overwrite = inputs
  
      # Full url of file
      url = posixpath.join(config.db_index_url, db, subdir, basefile)
  
      # Supposed size of the file
      remote_file_size = _remote_file_size(url)
  
      # Figure out where the file should be locally
      if keep_subdirs:
          dldir = os.path.join(dl_dir, subdir)
      else:
          dldir = dl_dir
  
      local_file = os.path.join(dldir, basefile)
  
      # The file exists locally.
      if os.path.isfile(local_file):
          # Redownload regardless
          if overwrite:
              dl_full_file(url, local_file)
          # Process accordingly.
          else:
              local_file_size = os.path.getsize(local_file)
              # Local file is smaller than it should be. Append it.
              if local_file_size < remote_file_size:
                  print('Detected partially downloaded file: %s Appending file...' % local_file)
                  headers = {"Range": "bytes="+str(local_file_size)+"-", 'Accept-Encoding': '*'}
                  r = requests.get(url, headers=headers, stream=True)
                  print('headers: ', headers)
                  print('r content length: ', len(r.content))
                  with open(local_file, 'ba') as writefile:
                      writefile.write(r.content)
                  print('Done appending.')
              # Local file is larger than it should be. Redownload.
              elif local_file_size > remote_file_size:
                  dl_full_file(url, local_file)
              # If they're the same size, do nothing.
  
      # The file doesn't exist. Download it.
      else:
          dl_full_file(url, local_file)
  
      return
docs: Download a file from physiobank.
  
      The input args are to be unpacked for the use of multiprocessing
      map, because python2 doesn't have starmap...