Use inspect.isgeneratorfunction() (related to #264017) [applied]