<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def locus_read_generator( samfile, chromosome, base1_position_before_variant, base1_position_after_variant, use_duplicate_reads=USE_DUPLICATE_READS, use_secondary_alignments=USE_SECONDARY_ALIGNMENTS, min_mapping_quality=MIN_READ_MAPPING_QUALITY):
 """ Generator that yields a sequence of ReadAtLocus records for reads which contain the positions before and after a variant. The actual work to figure out if what's between those positions matches a variant happens later in the `variant_reads` module. Parameters samfile : pysam.AlignmentFile chromosome : str base1_position_before_variant : int Genomic position of reference nucleotide before a variant base1_position_after_variant : int Genomic position of reference nucleotide before a variant use_duplicate_reads : bool By default, we're ignoring any duplicate reads use_secondary_alignments : bool By default we are using secondary alignments, set this to False to only use primary alignments of reads. min_mapping_quality : int Drop reads below this mapping quality Yields ReadAtLocus objects """

    logger.debug(
        "Gathering reads at locus %s: %d-%d",
        chromosome,
        base1_position_before_variant,
        base1_position_after_variant)
    base0_position_before_variant = base1_position_before_variant - 1
    base0_position_after_variant = base1_position_after_variant - 1

    count = 0

    # We get a pileup at the base before the variant and then check to make sure
    # that reads also overlap the reference position after the variant.
    #
    # TODO: scan over a wider interval of pileups and collect reads that don't
    # overlap the bases before/after a variant due to splicing
    for pileup_element in pileup_reads_at_position(
            samfile=samfile,
            chromosome=chromosome,
            base0_position=base0_position_before_variant):
        read = LocusRead.from_pysam_pileup_element(
            pileup_element,
            base0_position_before_variant=base0_position_before_variant,
            base0_position_after_variant=base0_position_after_variant,
            use_secondary_alignments=use_secondary_alignments,
            use_duplicate_reads=use_duplicate_reads,
            min_mapping_quality=min_mapping_quality)

        if read is not None:
            count += 1
            yield read

    logger.info(
        "Found %d reads overlapping locus %s: %d-%d",
        count,
        chromosome,
        base1_position_before_variant,
        base1_position_after_variant)