def write_records(records, output_file, split=False):
if split:<EOL><INDENT>for record in records:<EOL><INDENT>with open(<EOL>"<STR_LIT>".format(output_file, record.id), "<STR_LIT:w>"<EOL>) as record_handle:<EOL><INDENT>SeqIO.write(record, record_handle, "<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>SeqIO.write(records, output_file, "<STR_LIT>")<EOL><DEDENT>
Write FASTA records

    Write a FASTA file from an iterable of records.

    Parameters
    ----------
    records : iterable
        Input records to write.
    output_file : file, str or pathlib.Path
        Output FASTA file to be written into.
    split : bool, optional
        If True, each record is written into its own separate file. Default is
        False.