def stock2fa(stock):
seqs = {}<EOL>for line in stock:<EOL><INDENT>if line.startswith('<STR_LIT:#>') is False and line.startswith('<STR_LIT:U+0020>') is False and len(line) > <NUM_LIT:3>:<EOL><INDENT>id, seq = line.strip().split()<EOL>id = id.rsplit('<STR_LIT:/>', <NUM_LIT:1>)[<NUM_LIT:0>]<EOL>id = re.split('<STR_LIT>', id, <NUM_LIT:1>)[-<NUM_LIT:1>]<EOL>if id not in seqs:<EOL><INDENT>seqs[id] = []<EOL><DEDENT>seqs[id].append(seq)<EOL><DEDENT>if line.startswith('<STR_LIT>'):<EOL><INDENT>break<EOL><DEDENT><DEDENT>return seqs<EOL>
convert stockholm to fasta