def isgeneratorfunction(object):
 return bool(((isfunction(object) or ismethod(object)) and (object.func_code.co_flags & CO_GENERATOR)))

def isgeneratorfunction ( object ) : return bool ( ( ( isfunction ( object ) or ismethod ( object ) ) and ( object . func_code . co_flags & CO_GENERATOR ) ) )
return true if the object is a user-defined generator function .