def cleanString(s):
    """converts a string with leading and trailing and
    intermittent whitespace into a string that is stripped
    and has only single spaces between words
>>> cleanString('foo bar')
u'foo bar'
>>> cleanString('foo  bar')
u'foo bar'
>>> cleanString('\\n foo \\n\\n  bar ')
u'foo bar'
>>> cleanString('')
u''

    """
    return ' '.join(map(lambda x: x.strip(), s.split()))