This will clean up the url so that it is in the form:
            https://<SUB_DOMAIN>.eagleeyenetworks.com/
        :param url: str of the url
        :return: str of the clean base url
766614
def clean_base_uri(url):
        
        if url is None:
            return url
        if not '//' in url:
            url = 'https://' + url

        ret = url[:url.find('/', url.find('//') + 2) + 1] or url
        assert '.' in url, "<%s> is not a proper base_uri" % ret

        if not ret.endswith('/'):
            ret += '/'
        return ret
388683
def normalize_url(url: str) -> str:
    
    if url.startswith('/'):
        url = url[1:]

    if url.endswith('/'):
        url = url[:-1]

    return url
901070
def normalize(url):
    
    url = url.strip()
    if url == '':
        return ''
    parts = split(url)
    if parts.scheme:
        netloc = parts.netloc
        if parts.scheme in SCHEMES:
            path = normalize_path(parts.path)
        else:
            path = parts.path
    # url is relative, netloc (if present) is part of path
    else:
        netloc = parts.path
        path = ''
        if '/' in netloc:
            netloc, path_raw = netloc.split('/', 1)
            path = normalize_path('/' + path_raw)
    username, password, host, port = split_netloc(netloc)
    host = normalize_host(host)
    port = _normalize_port(parts.scheme, port)
    query = normalize_query(parts.query)
    fragment = normalize_fragment(parts.fragment)
    return construct(URL(parts.scheme, username, password, None, host, None,
                         port, path, query, fragment, None))
233890
def normalize_url(base_url, rel_url):
    
    if not rel_url:
        return None

    if not is_absolute_url(rel_url):
        rel_url = rel_url.replace("../", "/")

        if (not base_url.endswith("/")) and (not rel_url.startswith("/")):
            return base_url + "/" + rel_url.replace("../", "/")

        return base_url + rel_url.replace("../", "/")

    return rel_url
523797
def _make_full_url(self, url):
        

        return SLASH.join([self._api_base_url, url.lstrip(SLASH)])
777409
def fix_url(url):
    
    if url is None:
        return None

    url = url.strip()

    if url and not urlparse(url).scheme:
        url = "http://" + url

    return url
586528
def matching_base_url(self, url):
        

        n = len(self.baseurl)
        return url[0:n] == self.baseurl
365471
def http_purge_url(url):
    
    url = urlparse(url)
    connection = HTTPConnection(url.hostname, url.port or 80)
    path = url.path or '/'
    connection.request('PURGE', '%s?%s' % (path, url.query) if url.query else path, '',
                       {'Host': '%s:%s' % (url.hostname, url.port) if url.port else url.hostname})
    response = connection.getresponse()
    if response.status != 200:
        logging.error('Purge failed with status: %s' % response.status)
    return response
668403
def url(self, name, *, base=None, query=None, **match):
        
        return self.__router.url(name, base=base, query=query, **match)
1334423
def _get_url_base(cls, url):
        
        s = urlsplit(url)
        return urlunsplit([s.scheme, s.netloc, '', '', ''])
948886
def validate_url(cls, url):
        

        if url is None:
            return None

        url = url.strip()
        while url.endswith('/'):
            url = url[:-1]
        return url
509112
def get_domain_home_from_url(url):
    
    p = parse.urlparse(url)
    if p.netloc:
        return '{}://{}'.format(p.scheme, p.netloc), p.netloc
    else:
        return '', ''
1179396
def parse(url):
    
    parts = split(url)
    if parts.scheme:
        username, password, host, port = split_netloc(parts.netloc)
        subdomain, domain, tld = split_host(host)
    else:
        username = password = subdomain = domain = tld = port = ''
    return URL(parts.scheme, username, password, subdomain, domain, tld,
               port, parts.path, parts.query, parts.fragment, url)
961921
def remove_password_from_url(url):
    # type: (S) -> S
    

    parsed = _get_parsed_url(url)
    if parsed.auth:
        auth, _, _ = parsed.auth.partition(":")
        return parsed._replace(auth="{auth}:----".format(auth=auth)).url
    return parsed.url
731706
def normalize(url, strip=False):
    ""
    if strip:
        p = _urltools.parse(url)
        url = p.scheme + '://' + p.subdomain + p.domain + p.path
    return _urltools.normalize(url)
54982
def _IsValidUrl(self, url):
    
    parsed_url = urlparse.urlparse(url)
    return parsed_url.scheme in self._SUPPORTED_URL_SCHEMES
1231009
def clean_link(self, url):
        """"""
        return self._clean_re.sub(lambda match: "%%%2x" % ord(match.group(0)), url)