code: def maybe_download_and_extract(self):
          
          if not os.path.exists(self.cifar10_dir):
  
              if not os.path.exists(self.data_dir):
                  os.makedirs(self.data_dir)
  
              def _progress(count, block_size, total_size):
                  status_msg = '\r>> Downloading {} {:>3}%   '
                  sys.stdout.write(status_msg.format(self.cifar10_tarball, float(count * block_size) / total_size * 100.0))
                  sys.stdout.flush()
  
              file_path, _ = urlretrieve(CIFAR10_URL, self.cifar10_tarball, _progress)
  
              stat_info = os.stat(file_path)
              print('\nSuccessfully downloaded', file_path, stat_info.st_size, 'bytes.\n')
  
              tarfile.open(file_path, 'r:gz').extractall(self.data_dir)
docs: Download and extract the tarball from Alex Krizhevsky's website.