docs: def filename(self, index):
          '''
          Get the absolute filename corresponding to a key; run the
          key_transformer on the key and do a few other small things.
  
          :raises TypeError: if the key_transformer returns something other than
              a :py:class:`tuple` of :py:class:`strings <str>`
          :raises KeyError: if the key_transformer returns an empty path
          :returns: the filename
          :rtype: str
          '''
          subpath = self.key_transformer.to_path(index)
          if not isinstance(subpath, tuple):
              msg = 'subpath is a %s, but it should be a tuple.'
              raise TypeError(msg % type(subpath).__name__)
          elif len(subpath) == 0:
              raise KeyError('You specified an empty key.')
          elif not all(isinstance(x, str) for x in subpath):
              msg = 'Elements of subpath should all be str; here is subpath:\n%s' % repr(subpath)
              raise TypeError(msg)
          return os.path.join(self.base_directory, *safe_path(subpath)) + self.extension