<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def uridefrag(uristring):
 """Remove an existing fragment component from a URI reference string. """

    if isinstance(uristring, bytes):
        parts = uristring.partition(b'#')
    else:
        parts = uristring.partition(u'#')
    return DefragResult(parts[0], parts[2] if parts[1] else None)