def parse(raw):
        "Returns tuple of (session-id (str), capabilities (Capabilities)"
        sid, capabilities = 0, []
        root = to_ele(raw)
        for child in root.getchildren():
            if child.tag == qualify("session-id") or child.tag == "session-id":
                sid = child.text
            elif child.tag == qualify("capabilities") or child.tag == "capabilities" :
                for cap in child.getchildren():
                    if cap.tag == qualify("capability") or cap.tag == "capability":
                        capabilities.append(cap.text)
        return sid, Capabilities(capabilities)
def parse ( raw ) : sid , capabilities = 0 , [ ] root = to_ele ( raw ) for child in root . getchildren ( ) : if child . tag == qualify ( "session-id" ) or child . tag == "session-id" : sid = child . text elif child . tag == qualify ( "capabilities" ) or child . tag == "capabilities" : for cap in child . getchildren ( ) : if cap . tag == qualify ( "capability" ) or cap . tag == "capability" : capabilities . append ( cap . text ) return sid , Capabilities ( capabilities )
Returns tuple of (session-id (str), capabilities (Capabilities)