'Return a connection to the data server.'

@utils.Synchronized
def GetConnection(self):

    best = min(self.connections, key=(lambda x: x.NumPendingRequests()))
    if best.NumPendingRequests():
        if (len(self.connections) == self.max_connections):
            return best
        new = DataServerConnection(self)
        self.connections.append(new)
        return new
    else:
        return best
    return self.connections[0]
