def fastq_verifier(entries, ambiguous=False):
    """Raises error if invalid FASTQ format detected

    Args:
        entries (list): A list of FastqEntry instances

        ambiguous (bool): Permit ambiguous bases, i.e. permit non-ACGTU bases

    Raises:
        FormatError: Error when FASTQ format incorrect with descriptive message

    Example:
        >>> from bio_utils.iterators import fastq_iter
        >>> import os
        >>> entries = r'@entry1{0}AAGGATTCG{0}+{0}112234432{0}' \
        ...           r'@entry{0}AGGTCCCCCG{0}+{0}4229888884{0}' \
        ...           r'@entry3{0}GCCTAGC{0}9ddsa5n'.format(os.linesep)
        >>> fastq_entries = fastq_iter(iter(entries.split(os.linesep)))
        >>> fastq_verifier(fastq_entries)
    """

    if ambiguous:
        regex = r'^@.+{0}[ACGTURYKMSWBDHVNX]+{0}' \
                r'\+.*{0}[!"#$%&\'()*+,-./0123456' \
                r'789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ' \
                r'[\]^_`abcdefghijklmnopqrstuvwxyz' \
                r'{{|}}~]+{0}$'.format(os.linesep)
    else:
        regex = r'^@.+{0}[ACGTU]+{0}' \
                r'\+.*{0}[!-~]+{0}$'.format(os.linesep)
    delimiter = r'{0}'.format(os.linesep)

    for entry in entries:
        if len(entry.sequence) != len(entry.quality):
            msg = 'The number of bases in {0} does not match the number ' \
                  'of quality scores'.format(entry.id)
            raise FormatError(message=msg)
        try:
            entry_verifier([entry.write()], regex, delimiter)
        except FormatError as error:
            if error.part == 0:
                msg = 'Unknown Header Error with {0}'.format(entry.id)
                raise FormatError(message=msg)
            elif error.part == 1 and ambiguous:
                msg = '{0} contains a base not in ' \
                      '[ACGTURYKMSWBDHVNX]'.format(entry.id)
                raise FormatError(message=msg)
            elif error.part == 1 and not ambiguous:
                msg = '{0} contains a base not in ' \
                      '[ACGTU]'.format(entry.id)
                raise FormatError(message=msg)
            elif error.part == 2:
                msg = 'Unknown error with line 3 of {0}'.format(entry.id)
                raise FormatError(message=msg)
            elif error.part == 3:
                msg = r'{0} contains a quality score not in ' \
                      r'[!-~]'.format(entry.id)
                raise FormatError(message=msg)
            else:
                msg = '{0}: Unknown Error: Likely a Bug'.format(entry.id)
                raise FormatError(message=msg)
Raises error if invalid FASTQ format detected

    Args:
        entries (list): A list of FastqEntry instances

        ambiguous (bool): Permit ambiguous bases, i.e. permit non-ACGTU bases

    Raises:
        FormatError: Error when FASTQ format incorrect with descriptive message

    Example:
        >>> from bio_utils.iterators import fastq_iter
        >>> import os
        >>> entries = r'@entry1{0}AAGGATTCG{0}+{0}112234432{0}' \
        ...           r'@entry{0}AGGTCCCCCG{0}+{0}4229888884{0}' \
        ...           r'@entry3{0}GCCTAGC{0}9ddsa5n'.format(os.linesep)
        >>> fastq_entries = fastq_iter(iter(entries.split(os.linesep)))
        >>> fastq_verifier(fastq_entries)