    def public_url(self, server_name=''):
        """Get the public URL of a server by name

        Like server_url, but empty if no public URL is specified
        """
        # server_url will be a full URL if using subdomains
        url = self.server_url(server_name)
        if "://" not in url:
            # not using subdomains, public URL may be specified
            if self.settings.get("public_url"):
                # add server's base_url path prefix to public host
                url = urlunparse(self.settings["public_url"]._replace(path=url))
            else:
                # no public url (from subdomain or host),
                # leave unspecified
                url = ""
        return url
Get the public URL of a server by name

Like server_url, but empty if no public URL is specified
jupyterhub/user.py