def urljoin(base, *suburls):
    """Join base URL and zero or more subURLs.

    This function is best described by examples:

        >>> urljoin('http://example.com')
        'http://example.com/'

        >>> urljoin('http://example.com/')
        'http://example.com/'

        >>> urljoin('http://example.com', 'a', 'b/c', 'd')
        'http://example.com/a/b/c/d'

        >>> urljoin('http://example.com/', 'a', 'b/c', 'd')
        'http://example.com/a/b/c/d'

        >>> urljoin('http://example.com/a', 'b/c', 'd')
        'http://example.com/a/b/c/d'

        >>> urljoin('http://example.com/a/', 'b/c', 'd')
        'http://example.com/a/b/c/d'

    SubURLs should not contain trailing or leading slashes (with one exception:
    the last subURL may have a trailing slash).  SubURLs should not be empty.
    """
    if not base.endswith('/'):
        base += '/'
    return base + '/'.join(suburls)
