Inverted Index data structure written in python