def _download(out):
    def internal_download(url, filename):
        def dl_progress_callback_cmd(count, block_size, total_size):
            if count % 10 == 0:
                if count % 60 == 0:
                    out.write('%d%%' % (100 * min(count * block_size, total_size) / total_size))
                else:
                    out.write('.')

        if not os.path.exists(filename):
            out.writeln('Download %s' % filename, Color.CYAN)
            out.writeln('from %s' % url, Color.CYAN)
            urllib.urlretrieve(url, filename, reporthook=dl_progress_callback_cmd)
    return internal_download
dataset/ETHPy150Open biicode/client/hooks.py/_download/original