def splitem(query):
	"""
	Split a query into choices

	>>> splitem('dog, cat')
	['dog', 'cat']

	Disregards trailing punctuation.

	>>> splitem('dogs, cats???')
	['dogs', 'cats']
	>>> splitem('cats!!!')
	['cats']

	Allow or
	>>> splitem('dogs, cats or prarie dogs?')
	['dogs', 'cats', 'prarie dogs']

	Honors serial commas
	>>> splitem('dogs, cats, or prarie dogs?')
	['dogs', 'cats', 'prarie dogs']

	Allow choices to be prefixed by some ignored prompt.
	>>> splitem('stuff: a, b, c')
	['a', 'b', 'c']
	"""
	prompt, sep, query = query.rstrip('?.!').rpartition(':')

	choices = query.split(',')
	choices[-1:] = choices[-1].split(' or ')

	return [choice.strip() for choice in choices if choice.strip()]
def splitem ( query ) : prompt , sep , query = query . rstrip ( '?.!' ) . rpartition ( ':' ) choices = query . split ( ',' ) choices [ - 1 : ] = choices [ - 1 ] . split ( ' or ' ) return [ choice . strip ( ) for choice in choices if choice . strip ( ) ]
Split a query into choices

	>>> splitem('dog, cat')
	['dog', 'cat']

	Disregards trailing punctuation.

	>>> splitem('dogs, cats???')
	['dogs', 'cats']
	>>> splitem('cats!!!')
	['cats']

	Allow or
	>>> splitem('dogs, cats or prarie dogs?')
	['dogs', 'cats', 'prarie dogs']

	Honors serial commas
	>>> splitem('dogs, cats, or prarie dogs?')
	['dogs', 'cats', 'prarie dogs']

	Allow choices to be prefixed by some ignored prompt.
	>>> splitem('stuff: a, b, c')
	['a', 'b', 'c']