docs: def keyframe(self, index):
          """Set current keyframe. Load TiffPage from file if necessary."""
          index = int(index)
          if index < 0:
              index %= len(self)
          if self._keyframe.index == index:
              return
          if index == 0:
              self._keyframe = self.pages[0]
              return
          if self._indexed or index < len(self.pages):
              page = self.pages[index]
              if isinstance(page, TiffPage):
                  self._keyframe = page
                  return
              if isinstance(page, TiffFrame):
                  # remove existing TiffFrame
                  self.pages[index] = page.offset
          # load TiffPage from file
          tiffpage = self._tiffpage
          self._tiffpage = TiffPage
          try:
              self._keyframe = self._getitem(index)
          finally:
              self._tiffpage = tiffpage
          # always cache keyframes
          self.pages[index] = self._keyframe