import re


def tokenize( string ):
	""" Returns a string formatted in snake case. """
	token = re.sub('(.)([A-Z][a-z]+)', r'\1-\2', string)
	token = re.sub('([a-z0-9])([A-Z])', r'\1-\2', token).lower()
	token = re.sub(r"[_\s]+-?", '-', token)
	return token