def frame_to_grpos(self, frame):
        data_len = len(self._s.data)
        if frame < 0:
            frame = self._s.data_offset + data_len + frame

        raw_frame = frame - self._s.data_offset

        if 0 <= raw_frame < data_len:
            return defer.succeed(self._s.data[raw_frame][0])

        return defer.fail(InvalidFrameNumber('frame %r' % (frame,)))
dataset/ETHPy150Open arkadini/twimp/twimp/server/inmemory.py/IMStream.frame_to_grpos/original