'Sets the internet options'

def _set_internet_options(self, setting, on=True):

    InternetSetOption = windll.wininet.InternetSetOptionW
    InternetSetOption.argtypes = [LPVOID, DWORD, LPVOID, DWORD]
    InternetSetOption.restype = BOOL
    List = INTERNET_PER_CONN_OPTION_LIST()
    Option = (INTERNET_PER_CONN_OPTION * 3)()
    nSize = c_ulong(sizeof(INTERNET_PER_CONN_OPTION_LIST))
    Option[0].dwOption = self.INTERNET_PER_CONN_FLAGS
    Option[0].Value.dwValue = (2 if on else 1)
    Option[1].dwOption = self.INTERNET_PER_CONN_PROXY_SERVER
    Option[1].Value.pszValue = setting
    Option[2].dwOption = self.INTERNET_PER_CONN_PROXY_BYPASS
    Option[2].Value.pszValue = create_unicode_buffer('<-loopback>')
    List.dwSize = sizeof(INTERNET_PER_CONN_OPTION_LIST)
    List.pszConnection = None
    List.dwOptionCount = 3
    List.dwOptionError = 0
    List.pOptions = Option
    InternetSetOption(None, self.INTERNET_OPTION_PER_CONNECTION_OPTION, byref(List), nSize)
    InternetSetOption(None, self.INTERNET_OPTION_SETTINGS_CHANGED, None, 0)
    InternetSetOption(None, self.INTERNET_OPTION_REFRESH, None, 0)
