code: def replace_object(rdf, fromuri, touri, predicate=None):
      
      if fromuri == touri:
          return
      for s, p in rdf.subject_predicates(fromuri):
          if predicate is not None and p != predicate:
              continue
          rdf.remove((s, p, fromuri))
          if touri is not None:
              if not isinstance(touri, (list, tuple)):
                  touri = [touri]
              for uri in touri:
                  rdf.add((s, p, uri))
docs: Replace all occurrences of fromuri as object with touri in the given
      model.
  
      If touri=None, will delete all occurrences of fromuri instead.
      If touri is a list or tuple of URIRef, all values will be inserted.
      If predicate is given, modify only triples with the given predicate.