def METHOD_NAME(filename, njobs, index = None):
    if index is None:
        return [METHOD_NAME(filename, njobs, i) for i in range(njobs)]
    if njobs == 1:
        return filename
    fileExtension = None
    for extension in fileExtensions:
        if filename.endswith(extension):
            fileExtension = extension
    if fileExtension is None:
        raise AllInOneError(fileName + " does not end with any of the extensions "
                                     + str(fileExtensions))
    return replacelast(filename, fileExtension, "_" + str(index) + fileExtension)