def getConnection(self, connection_id):

        # need to do authz here

        def gotResult(connections):
            # we should get 0 or 1 here since connection id is unique
            if len(connections) == 0:
                return defer.fail( error.ConnectionNonExistentError('No connection with id %s' % connection_id) )
            self.db_connections[connection_id] = connections[0]
            return connections[0]

        if connection_id in self.db_connections:
            return defer.succeed(self.db_connections[connection_id])

        d = database.ServiceConnection.findBy(connection_id=connection_id)
        d.addCallback(gotResult)
        return d
dataset/ETHPy150Open NORDUnet/opennsa/opennsa/aggregator.py/Aggregator.getConnection/original