def merge_ndx(*args):
ndxs = []<EOL>struct = None<EOL>for fname in args:<EOL><INDENT>if fname.endswith('<STR_LIT>'):<EOL><INDENT>ndxs.append(fname)<EOL><DEDENT>else:<EOL><INDENT>if struct is not None:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>struct = fname<EOL><DEDENT><DEDENT>fd, multi_ndx = tempfile.mkstemp(suffix='<STR_LIT>', prefix='<STR_LIT>')<EOL>os.close(fd)<EOL>atexit.register(os.unlink, multi_ndx)<EOL>if struct:<EOL><INDENT>make_ndx = registry['<STR_LIT>'](f=struct, n=ndxs, o=multi_ndx)<EOL><DEDENT>else:<EOL><INDENT>make_ndx = registry['<STR_LIT>'](n=ndxs, o=multi_ndx)<EOL><DEDENT>_, _, _ = make_ndx(input=['<STR_LIT:q>'], stdout=False, stderr=False)<EOL>return multi_ndx<EOL>
Takes one or more index files and optionally one structure file and
    returns a path for a new merged index file.

    :param args: index files and zero or one structure file
    :return: path for the new merged index file