def METHOD_NAME(apath, outpath):
    # count = 0
    fnlist = list()
    for afile in os.listdir(apath):
        if not afile.endswith('.xml'):
            continue
        fnlist.append(afile)
    # now parallel processing:
    nthreads = 16
    for i in range(0, len(fnlist), nthreads):
        # fnlist[i, i+16]
        pool = multiprocessing.Pool(processes=nthreads)
        for j in range(nthreads):
            if i + j < len(fnlist):
                afile = os.path.join(apath, fnlist[i + j])
                pool.apply_async(parsexml, (afile, outpath))
        pool.close()
        pool.join()
    print('parallel {} threads done for {} files in total.'.format(
        nthreads, len(fnlist)))