String/phrase Parser in python