def getWordsUntilLength(t, maxLength):
    """take words until maxLength is reached
>>> getWordsUntilLength('this is a test', 60)
u'this is a test'
>>> getWordsUntilLength('this is a test', 7)
u'this is'
>>> getWordsUntilLength('this is a test', 2)
u'this'
    
    
    """
    t = t.replace(',', '')
    t = t.replace('.', '')
    T = t.split()
    while T:
        t = ' '.join(T)
        if len(t) <= maxLength:
            return t
        T.pop()
    else:
        # return first word
        return t