code: def keyring_auth(username=None, region=None, authenticate=True):
      
      if not keyring:
          # Module not installed
          raise exc.KeyringModuleNotInstalled("The 'keyring' Python module is "
                  "not installed on this system.")
      if username is None:
          username = settings.get("keyring_username")
      if not username:
          raise exc.KeyringUsernameMissing("No username specified for keyring "
                  "authentication.")
      password = keyring.get_password("pyrax", username)
      if password is None:
          raise exc.KeyringPasswordNotFound("No password was found for the "
                  "username '%s'." % username)
      set_credentials(username, password, region=region,
              authenticate=authenticate)
docs: Use the password stored within the keyring to authenticate. If a username
      is supplied, that name is used; otherwise, the keyring_username value
      from the config file is used.
  
      If there is no username defined, or if the keyring module is not installed,
      or there is no password set for the given username, the appropriate errors
      will be raised.
  
      If the region is passed, it will authenticate against the proper endpoint
      for that region, and set the default region for connections.