substitute '%s' with self._dir converted to a string. define the method key_to_file with self class instance, key and version defaulting to None as arguments.
def _key_to_file ( self , key , version = None ) :