def url_add_trailing_slash(uri: str) -> str:
    """Add trailing slash to url if this is valid

    Parameters
    ----------
    uri : str
        Web address to update

    Returns
    -------
    str
        uri or updated uri
    """

    if len(uri) == 0 or uri[-1] == "/":
        return uri

    split_uri = str.split(uri, "/")

    if len(split_uri) == 0:
        return f"{uri}/"
    if len(split_uri[-1]) > 1 and "?" not in split_uri[-1]:
        return f"{uri}/"
    return uri