def METHOD_NAME(gap_penalty, direction, score_only, should_raise):
    """
    Check if the `max_table_size` parameter in `align_local_gapped()`
    raises the expected `MemoryError` if the aligned regions get too
    large.
    """
    if should_raise:
        # This table size is exceed in this test case...
        max_table_size = 1_000_000
    else:
        # ... and this one is not
        max_table_size = 1_000_000_000
    # Align a long random sequence to itself,
    # effectively resulting in a global alignment 
    np.random.seed(0)
    seq1 = seq.NucleotideSequence()
    seq1.code = np.random.randint(len(seq1.alphabet), size=10000)
    matrix = align.SubstitutionMatrix.std_nucleotide_matrix()
    # Local alignment starts in the center of the sequences
    seed = (len(seq1) // 2, len(seq1) // 2)
    threshold = 100
    if should_raise:
        with pytest.raises(MemoryError):
            align.align_local_gapped(
                seq1, seq1, matrix, seed, threshold, gap_penalty, 1,
                direction, score_only, max_table_size
            )
    else:
        result = align.align_local_gapped(
            seq1, seq1, matrix, seed, threshold, gap_penalty, 1,
            direction, score_only, max_table_size
        )
        if not score_only and direction == "both":
            alignment = result[0]
            # Expect that no gaps are introduced
            assert len(alignment) == len(seq1