<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def strip(self):
 """Remove rollbacks, rollforwards, and all non-current files. When distributing a refpkg, you probably want to distribute as small a one as possible. strip removes everything from the refpkg which is not relevant to its current state. """

        self._sync_from_disk()
        current_filenames = set(self.contents['files'].values())
        all_filenames = set(os.listdir(self.path))
        to_delete = all_filenames.difference(current_filenames)
        to_delete.discard('CONTENTS.json')
        for f in to_delete:
            self._delete_file(f)
        self.contents['rollback'] = None
        self.contents['rollforward'] = None
        self.contents['log'].insert(
            0, 'Stripped refpkg (removed %d files)' % len(to_delete))
        self._sync_to_disk()