def download(directory, filename):
filepath = os.path.join(directory, filename)<EOL>if tf.io.gfile.exists(filepath):<EOL><INDENT>return filepath<EOL><DEDENT>if not tf.io.gfile.exists(directory):<EOL><INDENT>tf.io.gfile.makedirs(directory)<EOL><DEDENT>url = os.path.join(ROOT_PATH, filename)<EOL>print("<STR_LIT>" % (url, filepath))<EOL>urllib.request.urlretrieve(url, filepath)<EOL>return filepath<EOL>
Downloads a file.