Returns the http_proxy_url if proxy_username, proxy_password, proxy_host, and proxy_port
    config values are set.

    Returns a string.

def _get_http_proxy_url():
    '''
    Returns the http_proxy_url if proxy_username, proxy_password, proxy_host, and proxy_port
    config values are set.

    Returns a string.
    '''
    http_proxy_url = ''
    host = __salt__['config.option']('proxy_host')
    port = __salt__['config.option']('proxy_port')
    username = __salt__['config.option']('proxy_username')
    password = __salt__['config.option']('proxy_password')

    # Set http_proxy_url for use in various internet facing actions...eg apt-key adv
    if host and port:
        if username and password:
            http_proxy_url = 'http://{0}:{1}@{2}:{3}'.format(
                username,
                password,
                host,
                port
            )
        else:
            http_proxy_url = 'http://{0}:{1}'.format(
                host,
                port
            )

    return http_proxy_url