def _tokenize_by_character_class(s):
character_classes = [string.digits, string.ascii_letters, string.punctuation, string.whitespace]<EOL>result = []<EOL>rest = list(s)<EOL>while rest:<EOL><INDENT>progress = False<EOL>for character_class in character_classes:<EOL><INDENT>if rest[<NUM_LIT:0>] in character_class:<EOL><INDENT>progress = True<EOL>token = '<STR_LIT>'<EOL>for take_away in itertools.takewhile(lambda c: c in character_class, rest[:]):<EOL><INDENT>token += take_away<EOL>rest.pop(<NUM_LIT:0>)<EOL><DEDENT>result.append(token)<EOL>break<EOL><DEDENT><DEDENT>if not progress:  <EOL><INDENT>result.append(rest[<NUM_LIT:0>])<EOL>rest = rest[<NUM_LIT:1>:]<EOL><DEDENT><DEDENT>return result<EOL>
Return a list of strings by splitting s (tokenizing) by character class.

For example:
_tokenize_by_character_class('Sat Jan 11 19:54:52 MST 2014') => ['Sat', ' ', 'Jan', ' ', '11', ' ', '19', ':',
    '54', ':', '52', ' ', 'MST', ' ', '2014']
_tokenize_by_character_class('2013-08-14') => ['2013', '-', '08', '-', '14']