def split_modifiers(mod_string, mod_set=None):
	"""
	Removes modifiers from the given string and returns the 
	original name plus a list of the modifiers present (checked against mod_set if provided)
	
	>>> split_modifiers('joint_active_scaled_return', ['trace', 'scaled', 'return'])
	('joint_active', ['scaled', 'return'])
	>>> split_modifiers('joint_active_scaled')
	('joint', ['active', 'scaled'])
	
	>>> split_modifiers('joint_active_scaled', {'scaled':'fred','trace':'active'})
	('joint_active', ['scaled'])
	
	>>> split_modifiers('joint_scaled_trace')
	('joint', ['scaled', 'trace'])
	
	>>> split_modifiers('joint_trace_scaled')
	('joint', ['trace', 'scaled'])
	
	>>> split_modifiers('joint_scaled_active_trace', ['trace', 'scaled'])
	('joint_active', ['scaled', 'trace'])
	
	>>> split_modifiers('trace_rate_scaled', ['trace', 'scaled'])
	('trace_rate', ['scaled'])
	"""
	parts = mod_string.split('_')
	if mod_set is None:
		return (parts[0], parts[1:])
	name = [parts[0]]
	mods = []
	
	for p in parts[1:]:
		if p in mod_set:
			mods.append(p)
		else:
			name.append(p)
	
	return ('_'.join(name), mods)