code: def _configure_session() -> Session:
      """Configures the session for GET and POST requests.
  
      It enables a generous retrial strategy that waits for the application server to connect.
  
      """
      retry_strategy = Retry(
          # wait time between retries increases exponentially according to: backoff_factor * (2 ** (retry - 1))
          total=_CONNECTION_RETRY_TOTAL,
          backoff_factor=_CONNECTION_RETRY_BACKOFF_FACTOR,
          status_forcelist=[429, 500, 502, 503, 504],
      )
      adapter = HTTPAdapter(max_retries=retry_strategy)
      http = requests.Session()
      http.mount("https://", adapter)
      http.mount("http://", adapter)
      return http
  
imports: import socket
  from functools import wraps
  from typing import Any, Callable, Dict, Optional
  from urllib.parse import urljoin
  import requests
  from lightning_cloud.rest_client import GridRestClient, LightningClient, create_swagger_client
  from requests import Session
  from requests.adapters import HTTPAdapter
  from requests.exceptions import ConnectionError, ConnectTimeout, ReadTimeout
  from urllib3.util.retry import Retry
  from lightning.app.core import constants
  from lightning.app.utilities.app_helpers import Logger
label_desc: Use image node_id 3 for calling a global function with example usage: _configure_session() and returns: http