def METHOD_NAME(self, maxTasks, statusDict):
    """Utility function"""
    done = statusDict.get("Done", 0)
    failed = statusDict.get("Failed", 0)
    waiting = statusDict.get("Waiting", 0)
    total = statusDict.get("TotalCreated", 0)
    # If the failure rate is higher than acceptable
    if (total != 0) and ((100.0 * float(failed) / float(total)) > self.maxFailRate):
        return 0
    # If we already have enough completed jobs
    if done >= maxTasks:
        return 0
    if waiting > self.maxWaitingJobs:
        return 0
    numberOfTasks = maxTasks - (total - failed)
    if numberOfTasks < 0:
        # this happens when people extend the transformation manually instead of increasing MaxNumberOfTasks
        return 0
    if numberOfTasks > self.maxIterationTasks:
        numberOfTasks = self.maxIterationTasks
    return numberOfTasks