<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def prune(self):
 """ Prune the scenario ephemeral directory files and returns None. "safe files" will not be pruned, including the ansible configuration and inventory used by this scenario, the scenario state file, and files declared as "safe_files" in the ``driver`` configuration declared in ``molecule.yml``. :return: None """

        LOG.info('Pruning extra files from scenario ephemeral directory')
        safe_files = [
            self.config.provisioner.config_file,
            self.config.provisioner.inventory_file,
            self.config.state.state_file,
        ] + self.config.driver.safe_files
        files = util.os_walk(self.ephemeral_directory, '*')
        for f in files:
            if not any(sf for sf in safe_files if fnmatch.fnmatch(f, sf)):
                os.remove(f)

        # Remove empty directories.
        for dirpath, dirs, files in os.walk(
                self.ephemeral_directory, topdown=False):
            if not dirs and not files:
                os.removedirs(dirpath)