threadLimiter = threading.BoundedSemaphore(maximumNumberOfThreads)


class EncodeThread(threading.Thread):

    def run(self):
        threadLimiter.acquire()
How do I limit the number of active threads in python?