async def save_player_state(test_player):
    """Save the state of a player to restore after testing."""
    state = {}
    await test_player.async_update()
    state["power"] = test_player.power
    state["mode"] = test_player.mode
    state["time"] = test_player.time
    state["playlist"] = test_player.playlist.copy() if test_player.playlist else None
    state["sync_group"] = test_player.sync_group
    return state