code: def add_rmap_item(self, subj, pred, obj):
          
          def add_item(self, subj, pred, obj):
              try:
                  self.rmap[obj][pred].append(subj)
              except KeyError:
                  try:
                      self.rmap[obj][pred] = [subj]
                  except KeyError:
                      self.rmap[obj] = {pred: [subj]}
  
          if isinstance(obj, list):
              for item in obj:
                  add_item(self, subj, pred, item)
          else:
              add_item(self, subj, pred, obj)
docs: adds a triple to the inverted  dataset index