def _pprint_fasta(fasta, annotations=None, annotation_file=None,
                  block_length=10, blocks_per_line=6):
    """
    Pretty-print each record in the FASTA file.
    """
    annotations = annotations or []

    # Annotations by chromosome.
    as_by_chrom = collections.defaultdict(lambda: [a for a in annotations] or [])
    if annotation_file:
        for chrom, chrom_iter in _bed_iter(annotation_file):
            as_by_chrom[chrom].append(list(chrom_iter))

    for header, sequence in _fasta_iter(fasta):
        print(header)
        print(pprint_sequence(sequence,
                              annotations=as_by_chrom[header.split()[0]],
                              block_length=block_length,
                              blocks_per_line=blocks_per_line,
                              format=AnsiFormat))
Pretty-print each record in the FASTA file.