'Return a discovery URL for this realm.
This function does not check to make sure that the realm is
valid. Its behaviour on invalid inputs is undefined.
@rtype: str
@returns: The URL upon which relying party discovery should be run
in order to verify the return_to URL
@since: 2.1.0'

def buildDiscoveryURL(self):

    if self.wildcard:
        assert self.host.startswith('.'), self.host
        www_domain = ('www' + self.host)
        return ('%s://%s%s' % (self.proto, www_domain, self.path))
    else:
        return self.unparsed
