def href(*args, **kw):
    """
    Simple function for URL generation.  Position arguments are used for the
    URL path and keyword arguments are used for the url parameters.
    """
    result = [f"{request.script_root if request else ''}/"]
    for idx, arg in enumerate(args):
        result.append(f"{'/' if idx else ''}{quote(arg)}")
    if kw:
        result.append(f"?{urlencode(kw)}")
    return "".join(result)

    Simple function for URL generation.  Position arguments are used for the
    URL path and keyword arguments are used for the url parameters.
    
examples/simplewiki/utils.py