code: def get_session(username, password, locale=DEFAULT_LOCALE,
                  cookie_path=COOKIE_PATH):
      
      class UPSAuth(AuthBase):  # pylint: disable=too-few-public-methods
          """UPS authorization storage."""
  
          def __init__(self, username, password, locale, cookie_path):
              """Init."""
              self.username = username
              self.password = password
              self.locale = locale
              self.cookie_path = cookie_path
  
          def __call__(self, r):
              """Call is no-op."""
              return r
  
      session = requests.session()
      session.auth = UPSAuth(username, password, locale, cookie_path)
      if os.path.exists(cookie_path):
          session.cookies = _load_cookies(cookie_path)
      else:
          _login(session)
      return session
docs: Get UPS HTTP session.