Add #assert_valid_keys method