# -*- coding: utf-8 -*-
#!/usr/bin/env python
import re

whitespaceRE = re.compile("\s+", re.UNICODE)

def squeeze(text):
    text = text.rstrip()
    text = text.lstrip()
    return ' '.join(re.split(whitespaceRE, text))
    return text


def spaces(text): 
    """
    >>> spaces('a b c') == 2
    True

    >>> spaces('a b  c') == 3
    True

    >>> spaces(' a b  c') == 4 
    True
    """
    return text.count(' ')   

def _test():
   import doctest
   import whitespace
   options = doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE
   doctest.testmod(optionflags=options)

if __name__ == "__main__":
   _test()

