def _ensure_url_has_path(self, url):
        """ ensure the url has a path component
        eg. http://example.com#abc converted to http://example.com/#abc
        """
        inx = url.find('://')
        if inx > 0:
            rest = url[inx + 3:]
        elif url.startswith('//'):
            rest = url[2:]
        else:
            rest = url

        if '/' in rest:
            return url

        scheme, netloc, path, query, frag = urlsplit(url)
        if not path:
            path = '/'

        url = urlunsplit((scheme, netloc, path, query, frag))
        return url
def _ensure_url_has_path ( self , url ) : inx = url . find ( '://' ) if inx > 0 : rest = url [ inx + 3 : ] elif url . startswith ( '//' ) : rest = url [ 2 : ] else : rest = url if '/' in rest : return url scheme , netloc , path , query , frag = urlsplit ( url ) if not path : path = '/' url = urlunsplit ( ( scheme , netloc , path , query , frag ) ) return url
ensure the url has a path component
        eg. http://example.com#abc converted to http://example.com/#abc