def request_writes(self, offset, data):
if offset < self._next_offset:<EOL><INDENT>return []<EOL><DEDENT>writes = []<EOL>if offset in self._pending_offsets:<EOL><INDENT>return []<EOL><DEDENT>heapq.heappush(self._writes, (offset, data))<EOL>self._pending_offsets.add(offset)<EOL>while self._writes and self._writes[<NUM_LIT:0>][<NUM_LIT:0>] == self._next_offset:<EOL><INDENT>next_write = heapq.heappop(self._writes)<EOL>writes.append({'<STR_LIT>': next_write[<NUM_LIT:0>], '<STR_LIT:data>': next_write[<NUM_LIT:1>]})<EOL>self._pending_offsets.remove(next_write[<NUM_LIT:0>])<EOL>self._next_offset += len(next_write[<NUM_LIT:1>])<EOL><DEDENT>return writes<EOL>
Request any available writes given new incoming data.

        You call this method by providing new data along with the
        offset associated with the data.  If that new data unlocks
        any contiguous writes that can now be submitted, this
        method will return all applicable writes.

        This is done with 1 method call so you don't have to
        make two method calls (put(), get()) which acquires a lock
        each method call.