def urldefrag(url):
    if '#' in url:
        s, n, p, a, q, frag = urlparse(url)
        defrag = urlunparse((s, n, p, a, q, ''))
        return defrag, frag
    else:
        return url, ''
Removes any existing fragment from URL.
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/lib/urlparse.py/urldefrag