I have objective C code to detect dark mode to change the status bar:
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(darkModeChanged:) name:@"AppleInterfaceThemeChangedNotification" object:nil];
Similarly, how can we do the same in python?