def _discover(disp,ns,jid,node=None,fb2b=0,fb2a=1):
    """ Try to obtain info from the remote object.
        If remote object doesn't support disco fall back to browse (if fb2b is true)
        and if it doesnt support browse (or fb2b is not true) fall back to agents protocol
        (if gb2a is true). Returns obtained info. Used internally. """
    iq=Iq(to=jid,typ='get',queryNS=ns)
    if node: iq.setQuerynode(node)
    rep=disp.SendAndWaitForResponse(iq)
    if fb2b and not isResultNode(rep): rep=disp.SendAndWaitForResponse(Iq(to=jid,typ='get',queryNS=NS_BROWSE))   # Fallback to browse
    if fb2a and not isResultNode(rep): rep=disp.SendAndWaitForResponse(Iq(to=jid,typ='get',queryNS=NS_AGENTS))   # Fallback to agents
    if isResultNode(rep): return [n for n in rep.getQueryPayload() if isinstance(n, Node)]
    return []
 Try to obtain info from the remote object.
        If remote object doesn't support disco fall back to browse (if fb2b is true)
        and if it doesnt support browse (or fb2b is not true) fall back to agents protocol
        (if gb2a is true). Returns obtained info. Used internally. 
chrome-cordova/gcmServer/xmpp/features.py