def proxy_url(value, socks_scheme=None):
    """
    Parse a single proxy config value from FindProxyForURL() into a more usable element.

    :param str value: Value to parse, e.g.: ``DIRECT``, ``PROXY example.local:8080``, or ``SOCKS example.local:8080``.
    :param str socks_scheme: Scheme to assume for SOCKS proxies. ``socks5`` by default.
    :returns: Parsed value, e.g.: ``DIRECT``, ``http://example.local:8080``, or ``socks5://example.local:8080``.
    :rtype: str
    :raises ValueError: If input value is invalid.
    """
    if value.upper() == 'DIRECT':
        return 'DIRECT'
    parts = value.split()

    if len(parts) == 2:
        keyword, proxy = parts[0].upper(), parts[1]
        if keyword == 'HTTPS':
            return 'https://' + proxy
        if keyword == 'PROXY':
            return 'http://' + proxy
        if keyword == 'SOCKS':
            if not socks_scheme:
                socks_scheme = 'socks5'
            return '{0}://{1}'.format(socks_scheme, proxy)

    raise ValueError("Unrecognized proxy config value '{}'".format(value))