def smart_urljoin(base, url):
    """urljoin, only an empty fragment from the relative(?) URL will be
    preserved.
    """
    from .compat.moves.urllib.parse import urljoin
    joined = urljoin(base, url)
    if url.endswith('#') and not joined.endswith('#'):
        joined += '#'
    return joined
