def send(self,stanza):
        """ Serialise stanza and put it on the wire. Assign an unique ID to it before send.
            Returns assigned ID."""
        if [type(''), type(u'')] in type(stanza): return self._owner_send(stanza)
        if not isinstance(stanza,Protocol): _ID=None
        elif not stanza.getID():
            global ID
            ID+=1
            _ID=`ID`
            stanza.setID(_ID)
        else: _ID=stanza.getID()
        if self._owner._registered_name and not stanza.getAttr('from'): stanza.setAttr('from',self._owner._registered_name)
        if self._owner._route and stanza.getName()!='bind':
            to=self._owner.Server
            if stanza.getTo() and stanza.getTo().getDomain():
                to=stanza.getTo().getDomain()
            frm=stanza.getFrom()
            if frm.getDomain():
                frm=frm.getDomain()
            route=Protocol('route',to=to,frm=frm,payload=[stanza])
            stanza=route
        stanza.setNamespace(self._owner.Namespace)
        stanza.setParent(self._metastream)
        self._owner_send(stanza)
        return _ID
dataset/ETHPy150Open CouchPotato/CouchPotatoServer/libs/xmpp/dispatcher.py/Dispatcher.send/swapped operands of `in`