def parse_fasta(data):  
name, seq = None, []<EOL>for line in data:<EOL><INDENT>line = line.rstrip()<EOL>if line.startswith('<STR_LIT:>>'):<EOL><INDENT>if name:<EOL><INDENT>yield Sequence(name, '<STR_LIT>'.join(seq))<EOL><DEDENT>name, seq = line, []<EOL><DEDENT>else:<EOL><INDENT>seq.append(line)<EOL><DEDENT><DEDENT>if name:<EOL><INDENT>yield Sequence(name, '<STR_LIT>'.join(seq))<EOL><DEDENT>
Load sequences in Fasta format.

This generator function yields a Sequence object for each sequence record
in a GFF3 file. Implementation stolen shamelessly from
http://stackoverflow.com/a/7655072/459780.