def urljoin_bytes(*atoms):
    """Return the given path `*atoms`, joined into a single URL.

    This will correctly join a SCRIPT_NAME and PATH_INFO into the
    original URL, even if either atom is blank.
    """
    url = b'/'.join([x for x in atoms if x])
    while b'//' in url:
        url = url.replace(b'//', b'/')
    # Special-case the final url of "", and return "/" instead.
    return url or b'/'
Return the given path `*atoms`, joined into a single URL.

    This will correctly join a SCRIPT_NAME and PATH_INFO into the
    original URL, even if either atom is blank.
    
cherrypy/lib/httputil.py