<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def chain_frames(self):
 """Chains the frames. Requires ctypes or the speedups extension."""

        prev_tb = None
        for tb in self.frames:
            if prev_tb is not None:
                prev_tb.tb_next = tb
            prev_tb = tb
        prev_tb.tb_next = None