Replace function isgenerator which do'nt ddetect generators test by few checks if stettments