def METHOD_NAME(tb: TestbookNotebookClient, notebook_name: str, cell_source: str, s3_bucket: str) -> str:
    # This function is called before each cell is executed
    if notebook_name == 'functional_api':
        # avoid div by 0 errors with batch size of 1
        cell_source = cell_source.replace('num_epochs = 5', 'num_epochs = 1')
        cell_source = cell_source.replace('acc_percent = 100 * num_right / eval_size', 'acc_percent = 1')
        cell_source = cell_source.replace('batch_size = 1024', 'batch_size = 64')
        cell_source = cell_source.replace('download=True', 'download=False')
    if notebook_name == 'custom_speedup_methods':
        cell_source = cell_source.replace('resnet_56', 'resnet_9')
        cell_source = cell_source.replace('batch_size=1024', 'batch_size=64')
        cell_source = cell_source.replace('download=True', 'download=False')
    if notebook_name == 'finetune_huggingface':
        cell_source = cell_source.replace(
            'sst2_dataset = datasets.load_dataset("glue", "sst2")',
            'sst2_dataset = datasets.load_dataset("glue", "sst2", download_mode="force_redownload")')
        cell_source = cell_source.replace('batch_size=16', 'batch_size=2')
    if notebook_name == 'pretrain_finetune_huggingface':
        cell_source = cell_source.replace('batch_size=64', 'batch_size=1')
        cell_source = cell_source.replace('batch_size=32', 'batch_size=1')
    if notebook_name == 'early_stopping':
        cell_source = cell_source.replace('batch_size = 1024', 'batch_size = 64')
        cell_source = cell_source.replace('download=True', 'download=False')
    if notebook_name == 'getting_started':
        cell_source = cell_source.replace('batch_size = 1024', 'batch_size = 64')
        cell_source = cell_source.replace('download=True', 'download=False')
    if notebook_name == 'auto_microbatching':
        cell_source = cell_source.replace('download=True', 'download=False')
    if notebook_name == 'migrate_from_ptl':
        cell_source = cell_source.replace('batch_size=256', 'batch_size=64')
        cell_source = cell_source.replace('download=True', 'download=False')
    return cell_source