Python implementation language model