def _serialize_widget_state(state):
    """Serialize a widget state, following format in @jupyter-widgets/schema."""
    return {
        'model_name': state.get('_model_name'),
        'model_module': state.get('_model_module'),
        'model_module_version': state.get('_model_module_version'),
        'state': state,
    }