<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_primers(self, primers=None, mismatches=0, revcompl=False):
 """This functions starts with self because it's meant as an extension to the FASTA class."""

    # Default primers #
    if primers is None: primers = self.primers
    # Case straight #
    if not revcompl:
        fwd_regex = regex.compile("(%s){s<=%i}" % (primers.fwd_pattern, mismatches))
        rev_regex = regex.compile("(%s){s<=%i}" % (primers.rev_pattern, mismatches))
        generator = (ReadWithPrimers(r, fwd_regex, rev_regex) for r in self.parse())
    # Case revcompl #
    if revcompl:
        fwd_regex = regex.compile("(%s){s<=%i}" % (primers.fwd_pattern,          mismatches))
        rev_regex = regex.compile("(%s){s<=%i}" % (primers.rev_pattern_revcompl, mismatches))
        generator = (ReadWithPrimersRevCompl(r, fwd_regex, rev_regex) for r in self.parse())
    # Return #
    return GenWithLength(generator, len(self))