code: def update_mappings(self):
          
          self.pos2id = dict((v, k) for k, v in self.id2pos.iteritems())
          assert len(self.pos2id) == len(self.id2pos), "duplicate ids or positions detected"
docs: Synchronize id<->position mappings.