def __init__(self, login_url, cj, pw_mgr, save_cookies=True):
        """Construct new CosignHandler.

        Args:
          login_url: URL of cosign login page. Used to figure out if we
            have been redirected to the login page after a failed
            authentication, and as the URL to POST to to log in.

          cj: An http.cookiejar.CookieJar or equivalent. You'll need
            something that implements the FileCookieJar interface if
            you want to load/save cookies.

          pw_mgr: A CosignPasswordMgr object or equivalent. This
            object will provide (and if necessary prompt for) the
            username and password.

          save_cookies: Whether or not to save cookies to a file after
            each request. Required for single sign on between
            different scripts.
        """
        super().__init__()
        self.login_url = login_url
        self.cj = cj
        self.pw_mgr = pw_mgr
        self.save_cookies = save_cookies
        # try to load cookies from file (specified when constructing cj)
        try:
            self.cj.load(ignore_discard=True)
        except IOError:
            pass
Construct new CosignHandler.

        Args:
          login_url: URL of cosign login page. Used to figure out if we
            have been redirected to the login page after a failed
            authentication, and as the URL to POST to to log in.

          cj: An http.cookiejar.CookieJar or equivalent. You'll need
            something that implements the FileCookieJar interface if
            you want to load/save cookies.

          pw_mgr: A CosignPasswordMgr object or equivalent. This
            object will provide (and if necessary prompt for) the
            username and password.

          save_cookies: Whether or not to save cookies to a file after
            each request. Required for single sign on between
            different scripts.
        
recipes/Python/578217_Cosign_Handler/recipe-578217.py