load_tool: import a Python module, optionally using several directories.
	@param tool [string]: name of tool to import.
	@param tooldir [list]: directories to look for the tool.
	@return: the loaded module.

	Warning: this function is not thread-safe: plays with sys.path,
					 so must run in sequence.

def load_tool(tool,tooldir=None):
	'''
	load_tool: import a Python module, optionally using several directories.
	@param tool [string]: name of tool to import.
	@param tooldir [list]: directories to look for the tool.
	@return: the loaded module.

	Warning: this function is not thread-safe: plays with sys.path,
					 so must run in sequence.
	'''
	if tooldir:
		assert isinstance(tooldir,list)
		sys.path=tooldir+sys.path
	else:
		tooldir=[]
	try:
		return __import__(tool)
	finally:
		for dt in tooldir:
			sys.path.remove(dt)