Keyword Tree in Python