code: def save_password(url, username, password):
      
      if keyring:
          if ":" in username:
              raise RuntimeError(
                  "Unable to store credentials if username contains a ':' ({}).".format(
                      username
                  )
              )
  
          try:
              # Note: we pass the url as `username` and username:password as `password`
              if password is None:
                  keyring.delete_password("pyftpsync", url)
                  write("Delete credentials from keyring ({})".format(url))
              else:
                  keyring.set_password(
                      "pyftpsync", url, "{}:{}".format(username, password)
                  )
                  write(
                      "Store credentials in keyring ({}, {}:***).".format(url, username)
                  )
          #        except keyring.errors.TransientKeyringError:
          except Exception as e:
              write("Could not delete/set password {}.".format(e))
              pass  # e.g. user clicked 'no'
      else:
          write("Could not store credentials (missing keyring support).")
      return
docs: Store credentials in keyring.