code: def uridefrag(uristring):
      
      if isinstance(uristring, bytes):
          parts = uristring.partition(b'#')
      else:
          parts = uristring.partition(u'#')
      return DefragResult(parts[0], parts[2] if parts[1] else None)
docs: Remove an existing fragment component from a URI reference string.