code: def revert(self, filename=None,
                 ignore_discard=False, ignore_expires=False):
          
          if filename is None:
              if self.filename is not None: filename = self.filename
              else: raise ValueError(MISSING_FILENAME_TEXT)
  
          self._cookies_lock.acquire()
          try:
  
              old_state = copy.deepcopy(self._cookies)
              self._cookies = {}
              try:
                  self.load(filename, ignore_discard, ignore_expires)
              except (LoadError, IOError):
                  self._cookies = old_state
                  raise
  
          finally:
              self._cookies_lock.release()
docs: Clear all cookies and reload cookies from a saved file.
  
          Raises LoadError (or IOError) if reversion is not successful; the
          object's state will not be altered if this happens.