def _get_logon_details(self, openid):
        openid_doc = urllib2.urlopen(openid).read()
        xml = ElementTree.fromstring(openid_doc)

        hostname = None
        port = None
        username = None

        services = xml.findall('.//{%s}Service' % XRI_NS)
        for service in services:
            try:
                service_type = service.find(XRI_NS % '{%s}Type').text
            except AttributeError:
                continue

            # Detect myproxy hostname and port
            if service_type == MYPROXY_URN:
                myproxy_uri = service.find('{%s}URI' % XRI_NS).text
                mo = re.match(MYPROXY_URI_REXP, myproxy_uri)
                if mo:
                    hostname, port = mo.groups()

        # If the OpenID matches the standard ESGF pattern assume it contains
        # the username, otherwise prompt or raise an exception
        mo = re.match(ESGF_OPENID_REXP, openid)
        if mo:
            username = mo.group(1)
                
        #!TODO maybe support different myproxy port
        if port is not None:
            assert int(port) == 7512
            
        return username, hostname
dataset/ETHPy150Open stephenpascoe/esgf-pyclient/pyesgf/logon.py/LogonManager._get_logon_details/swapped operands of `%`