class_docstr: A stateful downloader to maintain a session to the website
      
class_docstr_tok: ["A","stateful","downloader","to","maintain","a","session","to","the","website"]
docstr: Parameters
  ----------
  allow_old: bool, optional
    If a Downloader allows for persistent sessions by some means -- flag
    instructs whether to use previous session, or establish a new one
  
  Returns
  -------
  bool
    To state if old instance of a session/authentication was used
code: def _establish_session(self, url, allow_old=True):
      """
  
      Parameters
      ----------
      allow_old: bool, optional
        If a Downloader allows for persistent sessions by some means -- flag
        instructs whether to use previous session, or establish a new one
  
      Returns
      -------
      bool
        To state if old instance of a session/authentication was used
      """
      if allow_old:
          if self._session:
              lgr.debug("http session: Reusing previous")
              return True  # we used old
          elif url in cookies_db:
              cookie_dict = cookies_db[url]
              lgr.debug(
                  "http session: Creating new with old cookies %s",
                  list(cookie_dict.keys()),
              )
              self._session = requests.Session()
              # not sure what happens if cookie is expired (need check to that or exception will prolly get thrown)
  
              # TODO dict_to_cookiejar doesn't preserve all fields when reversed
              self._session.cookies = (
                  requests.utils.cookiejar_from_dict(cookie_dict)
              )
              # TODO cookie could be expired w/ something like (but docs say it should be expired automatically):
              # http://docs.python-requests.org/en/latest/api/#requests.cookies.RequestsCookieJar.clear_expired_cookies
              # self._session.cookies.clear_expired_cookies()
              return True
  
      lgr.debug("http session: Creating brand new session")
      self._session = requests.Session()
      self._session.headers.update(self._headers)
      if self.authenticator:
          self.authenticator.authenticate(
              url, self.credential, self._session
          )
  
      return False
  
imports: import re
  import requests
  import requests.auth
  from requests.utils import parse_dict_header
  import io
  from time import sleep
  from ..None import __version__
  from ..utils import ensure_list_from_str, ensure_dict_from_str, ensure_bytes
  from ..dochelpers import borrowkwargs
  from ..ui import ui
  from ..utils import auto_repr
  from ..support.network import get_url_filename
  from ..support.network import get_response_disposition_filename
  from ..support.network import rfc2822_to_epoch
  from ..support.cookies import cookies_db
  from ..support.status import FileStatus
  from ..support.exceptions import AccessDeniedError, AccessFailedError, CapturedException, DownloadError, UnhandledRedirectError
  from .base import Authenticator
  from .base import BaseDownloader, DownloaderSession
  from logging import getLogger
  from ..log import LoggerHelper
label_desc: Use image node_id 2 for calling the HTTPDownloader obj's underlying member method code with example usage: obj._establish_session(url, allow_old) and returns: False, True, True