def get_fragment(uri):
    """
    Get the final part of the URI.

    The final part is the text after the last hash (#) or slash (/), and is
    typically the part that varies and is appended to the namespace.

    Args:
        uri: The full URI to extract the fragment from.

    Returns:
        The final part of the given URI.
    """
    fragment_delimiters = ('#', '/')
    alternatives = tuple(
        uri.rsplit(delimiter, maxsplit=1)[-1]
        for delimiter in fragment_delimiters
        if delimiter in uri
    )
    # Return whatever alternative is shortest
    return min(alternatives, key=len)