def update_password(self, new_password):

        rc = Security.lib.SecKeychainItemModifyAttributesAndData(
            self.keychain_item,
            None,
            len(new_password),
            new_password
        )

        if rc == -61:
            raise RuntimeError("Permission denied updating %s" % self)
        elif rc != 0:
            raise RuntimeError("Unable to update password for %s: rc = %d" % rc)
Change the stored password
dataset/ETHPy150Open MacSysadmin/pymacadmin/lib/PyMacAdmin/Security/Keychain.py/GenericPassword.update_password