human
Complete the below
def download_and_uncompress_tarball(tarball_url, dataset_dir):

    ''''Downloads the `tarball_url` and uncompresses it locally.
    Args:
    tarball_url: The URL of a tarball file.
    dataset_dir: The directory where the temporary files are stored.'
    '''
assistant
#Here is the Python code you requested.
    filename = tarball_url.split('/')[(-1)]
    filepath = os.path.join(dataset_dir, filename)
    def _progress(count, block_size, total_size):
        sys.stdout.write(('\r>>    Downloading    %s    %.1f%%' % (filename, ((float((count * block_size)) / float(total_size)) * 100.0))))
        sys.stdout.flush()
    (filepath, _) = urllib.request.urlretrieve(tarball_url, filepath, _progress)
    print()
    statinfo = os.stat(filepath)
    print('Successfully    downloaded', filename, statinfo.st_size, 'bytes.')
    tarfile.open(filepath, 'r:gz').extractall(dataset_dir)