def get_request_id(self):
        try:
            return self.request_ids.popleft()
        except IndexError:
            self.highest_request_id += 1
            # in_flight checks should guarantee this
            assert self.highest_request_id <= self.max_request_id
            return self.highest_request_id
This must be called while self.lock is held.
dataset/ETHPy150Open datastax/python-driver/cassandra/connection.py/Connection.get_request_id