def _general_multithread(func):
    """ return the general multithreading function using func """

    def multithread(templates, stream, *args, **kwargs):
        with pool_boy(ThreadPool, len(stream), **kwargs) as pool:
            return _pool_normxcorr(templates, stream, pool=pool, func=func)

    return multithread
return the general multithreading function using func