def urljoin(netloc, port, ssl):
    """
    Basically the counter-part of :func:`urlsplit`.
    """
    rv = ('https' if ssl else 'http') + '://' + netloc
    if ssl and port != 443 or not ssl and port != 80:
        rv += ':%i' % port
    return rv
