def download_file_from_google_drive(file_id, root, filename=None, md5=None):
<EOL>import requests<EOL>url = "<STR_LIT>"<EOL>root = os.path.expanduser(root)<EOL>if not filename:<EOL><INDENT>filename = file_id<EOL><DEDENT>fpath = os.path.join(root, filename)<EOL>makedir_exist_ok(root)<EOL>if os.path.isfile(fpath) and check_integrity(fpath, md5):<EOL><INDENT>print('<STR_LIT>' + fpath)<EOL><DEDENT>else:<EOL><INDENT>session = requests.Session()<EOL>response = session.get(url, params={'<STR_LIT:id>': file_id}, stream=True)<EOL>token = _get_confirm_token(response)<EOL>if token:<EOL><INDENT>params = {'<STR_LIT:id>': file_id, '<STR_LIT>': token}<EOL>response = session.get(url, params=params, stream=True)<EOL><DEDENT>_save_response_content(response, fpath)<EOL><DEDENT>
Download a Google Drive file from  and place it in root.

    Args:
        file_id (str): id of file to be downloaded
        root (str): Directory to place downloaded file in
        filename (str, optional): Name to save the file under. If None, use the id of the file.
        md5 (str, optional): MD5 checksum of the download. If None, do not check