def METHOD_NAME (i, tle, rootdir, itemdefID, allItems, url, options):
	for relpath in allItems:
		try:
			fullpath = join (rootdir, join (*relpath))
			name = relpath [-1]
			print "%i: Creating item for %s..." % (i, name)
			item = tle.createNewItem (itemdefID)
			item.setNode ('item/toolbox/toolbox.code', relpath [0])
			item.setNode ('item/toolbox/source', 'toolbox')
			item.createNode ('item/toolbox/training.package', extractCodes (fullpath))
			finalurl = '%sitems/%s/1/' % (url, item.getUUID ())
			if options.nosubmit:
				item.printXml ()
			else:
				print "%i: Uploading %s" % (i, name)
				item.attachIMS (file (fullpath, 'rb'), name, name, showstatus='%i: ' % i)
				print "%i: Submitting %s" % (i, name)
				item.submit ()
				file ('%s.complete.txt' % fullpath, 'wb').write (finalurl)
				print "%i: Finished %s" % (i, name)
		except:
			traceback.print_exc ()