async def _location_auth_protect(self, location):
        '''
        Checks to see if the new location is
            1. The same top level domain
            2. As or more secure than the current connection type

        Returns:
            True (bool): If the current top level domain is the same
                and the connection type is equally or more secure.
                False otherwise.
        '''
        netloc_sans_port = self.host.split(':')[0]
        netloc_sans_port = netloc_sans_port.replace(
            (re.match(_WWX_MATCH, netloc_sans_port)[0]), '')

        base_domain = '.'.join(netloc_sans_port.split('.')[-2:])

        l_scheme, l_netloc, _, _, _, _ = urlparse(location)
        location_sans_port = l_netloc.split(':')[0]
        location_sans_port = location_sans_port.replace(
            (re.match(_WWX_MATCH, location_sans_port)[0]), '')

        location_domain = '.'.join(location_sans_port.split('.')[-2:])

        if base_domain == location_domain:
            if l_scheme < self.scheme:
                return False
            else:
                return True
async def _location_auth_protect ( self , location ) : netloc_sans_port = self . host . split ( ':' ) [ 0 ] netloc_sans_port = netloc_sans_port . replace ( ( re . match ( _WWX_MATCH , netloc_sans_port ) [ 0 ] ) , '' ) base_domain = '.' . join ( netloc_sans_port . split ( '.' ) [ - 2 : ] ) l_scheme , l_netloc , _ , _ , _ , _ = urlparse ( location ) location_sans_port = l_netloc . split ( ':' ) [ 0 ] location_sans_port = location_sans_port . replace ( ( re . match ( _WWX_MATCH , location_sans_port ) [ 0 ] ) , '' ) location_domain = '.' . join ( location_sans_port . split ( '.' ) [ - 2 : ] ) if base_domain == location_domain : if l_scheme < self . scheme : return False else : return True
Checks to see if the new location is
            1. The same top level domain
            2. As or more secure than the current connection type

        Returns:
            True (bool): If the current top level domain is the same
                and the connection type is equally or more secure.
                False otherwise.