<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def replace_subject(rdf, fromuri, touri):
 """Replace occurrences of fromuri as subject with touri in given model. If touri=None, will delete all occurrences of fromuri instead. If touri is a list or tuple of URIRefs, all values will be inserted. """

    if fromuri == touri:
        return
    for p, o in rdf.predicate_objects(fromuri):
        rdf.remove((fromuri, p, o))
        if touri is not None:
            if not isinstance(touri, (list, tuple)):
                touri = [touri]
            for uri in touri:
                rdf.add((uri, p, o))