def splitFragP(uriref, punct=0):
    """split a URI reference before the fragment
    Punctuation is kept.
    e.g.
    >>> splitFragP("abc#def")
    ('abc', '#def')
    >>> splitFragP("abcdef")
    ('abcdef', '')
    """

    i = uriref.rfind("#")
    if i >= 0:
        return uriref[:i], uriref[i:]
    else:
        return uriref, ""