def validateSelection(**keywords):
	selection = ''
	msg = keywords.setdefault('msg')
	name = keywords.setdefault('name', 'object(s)')
	try: selection = cmds.ls(sl=True, l=True, type=keywords['type'])
	except: selection = cmds.ls(sl=True, l=True)

	# if the exact key is provided, then it takes precedence
	isException = False
	if 'exact' in keywords and len(selection) is not keywords['exact']:
		if not msg: msg = 'Please select exactly %s %s'%(keywords['exact'], name)		
		isException = True
	else:
		if 'min' in keywords and len(selection) < keywords['min']:
			if not msg: msg = 'Error: You must select at least %s %s'%(keywords['min'], name)
			isException = True
		if 'max' in keywords and len(selection) > keywords['max']:
			if not msg: msg = 'Error: You may select no more than %s %s'%(keywords['max'], name)
			isException = True
	
	# raise an exception or return the selection list
	if isException: raiseExceptionWithMessage(msg, 1)
	else: return selection
L{getDeprecationWarningString} returns a string that tells us that a
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/amTools/utilities/dg.py/validateSelection--crossover with--dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/python/test/test_deprecate.py/TestDeprecationWarnings.test_getDeprecationWarningStringWithFormat