'Discard all expired cookies.
You probably don\'t need to call this method: expired cookies are never
sent back to the server (provided you\'re using DefaultCookiePolicy),
this method is called by CookieJar itself every so often, and the
.save() method won\'t save expired cookies anyway (unless you ask
otherwise by passing a true ignore_expires argument).'

def clear_expired_cookies(self):

    self._cookies_lock.acquire()
    try:
        now = time.time()
        for cookie in self:
            if cookie.is_expired(now):
                self.clear(cookie.domain, cookie.path, cookie.name)
    finally:
        self._cookies_lock.release()
