def METHOD_NAME(event, **kwargs):
    theme = event.category.default_event_themes.get(event.type_.name) if event.category else None
    if theme is None:
        layout_settings.delete(event, 'timetable_theme')
    else:
        layout_settings.set(event, 'timetable_theme', theme)