code: def frames(self, key=None, orig_order=False):
          if key is not None:
              key = self._normalize_key(key)
              if len(self._frames[key]) == 0:
                  raise KeyError("Key not found: " + repr(key))
              return self._frames[key]
          frames = []
          for frameid in self._frames.keys():
              for frame in self._frames[frameid]:
                  frames.append(frame)
          if orig_order:
              key = (lambda frame: 
                     (0, frame.frameno) 
                     if frame.frameno is not None 
                     else (1,))
          else:
              key = self.frame_order.key
          frames.sort(key=key)
          return frames