def interleave(infile_1, infile_2, outfile, suffix1=None, suffix2=None):
seq_reader_1 = sequences.file_reader(infile_1)<EOL>seq_reader_2 = sequences.file_reader(infile_2)<EOL>f_out = utils.open_file_write(outfile)<EOL>for seq_1 in seq_reader_1:<EOL><INDENT>try:<EOL><INDENT>seq_2 = next(seq_reader_2)<EOL><DEDENT>except:<EOL><INDENT>utils.close(f_out)<EOL>raise Error('<STR_LIT>', seq_1.id, '<STR_LIT>')<EOL><DEDENT>if suffix1 is not None and not seq_1.id.endswith(suffix1):<EOL><INDENT>seq_1.id += suffix1<EOL><DEDENT>if suffix2 is not None and not seq_2.id.endswith(suffix2):<EOL><INDENT>seq_2.id += suffix2<EOL><DEDENT>print(seq_1, file=f_out)<EOL>print(seq_2, file=f_out)<EOL><DEDENT>try:<EOL><INDENT>seq_2 = next(seq_reader_2)<EOL><DEDENT>except:<EOL><INDENT>seq_2 = None<EOL><DEDENT>if seq_2 is not None:<EOL><INDENT>utils.close(f_out)<EOL>raise Error('<STR_LIT>', seq_2.id, '<STR_LIT>')<EOL><DEDENT>utils.close(f_out)<EOL>
Makes interleaved file from two sequence files. If used, will append suffix1 onto end
    of every sequence name in infile_1, unless it already ends with suffix1. Similar for sufffix2.