code: def sweep(self):
          '''
          Sweep the cache and remove the outdated or least frequently
          used entries
          '''
          if self.max_age < time.time() - self.timestamp:
              self.clear()
              self.timestamp = time.time()
          else:
              paterns = list(self.cache.values())
              paterns.sort()
              for idx in range(self.clear_size):
                  del self.cache[paterns[idx][2]f sweep(self):
          '''
          Sweep the cache and remove the outdated or least frequently
          used entries
          '''
          if self.max_age < time.time() - self.timestamp:
              self.clear()
              self.timestamp = time.time()
          else:
              paterns = list(self.cache.values())
              paterns.sort()
              for idx in range(self.clear_size):
                  del self.cache[paterns[idx][2]]
docs: Sweep the cache and remove the outdated or least frequently
          used entries