code: def new_request_session(config, cookies):
      
      session = requests.Session()
      if cookies:
          session.cookies = cookies
      session.max_redirects = config["maxhttpredirects"]
      session.headers.update({
          "User-Agent": config["useragent"],
      })
      if config["cookiefile"]:
          for cookie in cookies.from_file(config["cookiefile"]):
              session.cookies = requests.cookies.merge_cookies(session.cookies, cookie)
      return session
docs: Create a new request session.