def _write_cluster(metacluster, cluster, loci, idx, path):
out_file = op.join(path, '<STR_LIT>', str(idx) + '<STR_LIT>')<EOL>with utils.safe_run(out_file):<EOL><INDENT>with open(out_file, '<STR_LIT:w>') as out_handle:<EOL><INDENT>for idc in metacluster:<EOL><INDENT>for idl in cluster[idc].loci2seq:<EOL><INDENT>pos = loci[idl].list()<EOL>print("<STR_LIT:\t>".join(pos[:<NUM_LIT:4>] + [str(len(cluster[idc].loci2seq[idl]))] + [pos[-<NUM_LIT:1>]]), file=out_handle, end="<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
For complex meta-clusters, write all the loci for further debug