code: def clean_unused_venvs(self, max_days_to_keep):
          
          with filelock(self.stat_file_lock):
              now = datetime.utcnow()
              venvs_dict = self._get_compacted_dict_usage_from_file()
              for venv_uuid, usage_date in venvs_dict.copy().items():
                  usage_date = self._str_to_datetime(usage_date)
                  if (now - usage_date).days > max_days_to_keep:
                      # remove venv from usage dict
                      del venvs_dict[venv_uuid]
                      venv_meta = self.venvscache.get_venv(uuid=venv_uuid)
                      if venv_meta is None:
                          # if meta isn't found means that something had failed previously and
                          # usage_file wasn't updated.
                          continue
                      env_path = venv_meta['env_path']
                      logger.info("Destroying virtualenv at: %s", env_path)  # #256
                      destroy_venv(env_path, self.venvscache)
  
              self._write_compacted_dict_usage_to_file(venvs_dict)
docs: Compact usage stats and remove venvs.
  
          This method loads the complete file usage in memory, for every venv compact all records in
          one (the lastest), updates this info for every env deleted and, finally, write the entire
          file to disk.
  
          If something failed during this steps, usage file remains unchanged and can contain some
          data about some deleted env. This is not a problem, the next time this function it's
          called, this records will be deleted.