def download_files(manifest, download_dir, auth_token=None,<EOL>chunk_size=<NUM_LIT>, avoid_redownload=True):
assert isinstance(manifest, pd.DataFrame)<EOL>assert isinstance(download_dir, str)<EOL>assert isinstance(chunk_size, int)<EOL>if auth_token is not None:<EOL><INDENT>assert isinstance(auth_token, str)<EOL><DEDENT>def get_file_md5hash(path):<EOL><INDENT>"""<STR_LIT>"""<EOL>with open(path, '<STR_LIT:rb>') as fh:<EOL><INDENT>h = hashlib.md5(fh.read()).hexdigest()<EOL><DEDENT>return h<EOL><DEDENT>headers = {}<EOL>if auth_token is not None:<EOL><INDENT>headers['<STR_LIT>'] = auth_token<EOL><DEDENT>num_files = manifest.shape[<NUM_LIT:0>]<EOL>logger.info('<STR_LIT>', num_files, download_dir)<EOL>for i, row in manifest.iterrows():<EOL><INDENT>success = False        <EOL>download_file = os.path.join(download_dir, row['<STR_LIT:filename>'])<EOL>if ((i+<NUM_LIT:1>) % <NUM_LIT:100>) == <NUM_LIT:0>:<EOL><INDENT>logger.info('<STR_LIT>', i+<NUM_LIT:1>, num_files)<EOL><DEDENT>if avoid_redownload and os.path.isfile(download_file) andget_file_md5hash(download_file) == row['<STR_LIT>']:<EOL><INDENT>logger.info('<STR_LIT>',<EOL>download_file)<EOL>success = True<EOL><DEDENT>while not success:<EOL><INDENT>with closing(<EOL>requests.get('<STR_LIT>'<EOL>% row['<STR_LIT:id>'], headers=headers, stream=True))as r:<EOL><INDENT>r.raise_for_status()<EOL>with open(download_file, '<STR_LIT:wb>') as ofh:<EOL><INDENT>for chunk in r.iter_content(chunk_size=chunk_size): <EOL><INDENT>if chunk: <EOL><INDENT>ofh.write(chunk)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>with open(download_file, '<STR_LIT:rb>') as fh:<EOL><INDENT>h = hashlib.md5(fh.read()).hexdigest()<EOL>if h == row['<STR_LIT>']:<EOL><INDENT>success = True<EOL><DEDENT><DEDENT>if not success:<EOL><INDENT>logger.warning('<STR_LIT>'<EOL>'<STR_LIT>',<EOL>row['<STR_LIT>'], h)<EOL><DEDENT><DEDENT><DEDENT>
Individually download files from GDC.

    Params
    ------
    manifest : `pandas.DataFrame`
        GDC manifest that contains a list of files. The data frame should
        have five columns: id, filename, md5, size, and state.
    download_dir : str
        The path of the download directory.
    auth_token : str, optional
        Authentication token for downloading protected data.
        If None, do not send authentication header. [None]
    chunk_size : int, optional
        The chunk size (in bytes) to use for downloading data. [1048576]

    Returns
    -------
    None