def _bindUDP(self, q2qsrc, q2qdst, udpsrc, udpdst, protocol):

        # we are representing the src, because they are the ones being told to
        # originate a UDP packet.

        self.verifyCertificateAllowed(q2qsrc, q2qdst)

        # if I've got a local factory for this 3-tuple, do the bind if I own
        # this IP...
        srchost, srcport = udpsrc

        lcget = self.service.listeningClients.get((q2qsrc, protocol), ())

        bindery = []

        for (listener, listenCert, desc
                 ) in lcget:
            # print 'looking at listener', listener
            # print listener.transport.getPeer().host, srchost
            if listener.transport.getPeer().host == srchost:
                # print 'bound in clients loop'

                d = listener.callRemote(
                    BindUDP,
                    q2qsrc=q2qsrc,
                    q2qdst=q2qdst,
                    udpsrc=udpsrc,
                    udpdst=udpdst,
                    protocol=protocol)
                def swallowKnown(err):
                    err.trap(error.ConnectionDone, error.ConnectionLost)
                d.addErrback(swallowKnown)
                bindery.append(d)
        if bindery:
            # print 'bindery return', len(bindery)
            def _justADict(ign):
                return dict()
            return defer.DeferredList(bindery).addCallback(_justADict)

        # print 'what?', lcget
        if (self.service.getLocalFactories(q2qdst, q2qsrc, protocol)
            and srchost == self._determinePublicIP()):
            self.service.dispatcher.seedNAT(udpdst, srcport, conditional=True)
            # print 'bound locally'
            return dict()
        # print 'conn-error'
        raise ConnectionError("unable to find appropriate UDP binder")
dataset/ETHPy150Open twisted/vertex/vertex/q2q.py/Q2Q._bindUDP/original