def maybe_extract(filename, force=False):
    root = os.path.splitext(os.path.splitext(filename)[0])[0]
    if (os.path.isdir(root) and (not force)):
        print(('%s already present - Skipping extraction of %s.' % (root, filename)))
    else:
        print(('Extracting data for %s. This may take a while. Please wait.' % root))
        tar = tarfile.open(filename)
        sys.stdout.flush()
        tar.extractall(data_root)
        tar.close()
    data_folders = [os.path.join(root, d) for d in sorted(os.listdir(root)) if os.path.isdir(os.path.join(root, d))]
    if (len(data_folders) != num_classes):
        raise Exception(('Expected %d folders, one per class. Found %d instead.' % (num_classes, len(data_folders))))
    print(data_folders)
    return data_folders
def maybe_extract(filename, force=False):
    root = os.path.splitext(os.path.splitext(filename)[0])[0]
    if (os.path.isdir(root) and (not force)):
        print(('%s already present - Skipping extraction of %s.' % (root, filename)))
    else:
        print(('Extracting data for %s. This may take a while. Please wait.' % root))
        tar = tarfile.open(filename)
        sys.stdout.flush()
        tar.extractall(data_root)
        tar.close()
    data_folders = [os.path.join(root, d) for d in sorted(os.listdir(root)) if os.path.isdir(os.path.join(root, d))]
    if (len(data_folders) != num_classes):
        raise Exception(('Expected %d folders, one per class. Found %d instead.' % (num_classes, len(data_folders))))
    print(data_folders)
    return data_folders