A toy inverted index in Python